}
case CLASS_PALADIN:
+ case CLASS_SNIPER:
{
/* Bad sensing */
if (0 != randint0(77777L / (plev * plev + 40))) return;
case CLASS_SAMURAI:
case CLASS_CAVALRY:
case CLASS_BERSERKER:
+ case CLASS_SNIPER:
{
return;
}
#else
else if (get_check("Normal teleport? "))
#endif
-
{
- teleport_player(200, FALSE);
+ teleport_player(200, 0L);
return;
}
else
static void wreck_the_pattern(void)
{
int to_ruin = 0, r_y, r_x;
- int pattern_type = f_info[cave[py][px].feat].power;
+ int pattern_type = f_info[cave[py][px].feat].subtype;
if (pattern_type == PATTERN_TILE_WRECKED)
{
scatter(&r_y, &r_x, py, px, 4, 0);
if (pattern_tile(r_y, r_x) &&
- (f_info[cave[r_y][r_x].feat].power != PATTERN_TILE_WRECKED))
+ (f_info[cave[r_y][r_x].feat].subtype != PATTERN_TILE_WRECKED))
{
- cave_set_feat(r_y, r_x, FEAT_PATTERN_XTRA2);
+ cave_set_feat(r_y, r_x, feat_pattern_corrupted);
}
}
- cave_set_feat(py, px, FEAT_PATTERN_XTRA2);
+ cave_set_feat(py, px, feat_pattern_corrupted);
}
wreck_the_pattern();
}
- pattern_type = f_info[cave[py][px].feat].power;
+ pattern_type = f_info[cave[py][px].feat].subtype;
switch (pattern_type)
{
(void)restore_level();
(void)hp_player(1000);
- cave_set_feat(py, px, FEAT_PATTERN_OLD);
+ cave_set_feat(py, px, feat_pattern_old);
#ifdef JP
msg_print("¡Ö¥Ñ¥¿¡¼¥ó¡×¤Î¤³¤ÎÉôʬ¤Ï¾¤ÎÉôʬ¤è¤ê¶¯ÎϤǤʤ¤¤è¤¦¤À¡£");
}
-/*
- * Process the counters of monsters (once per 10 game turns)
- *
- * This function is to process monsters' counters same as player's.
- */
-static void process_monsters_counters(void)
-{
- int m_idx;
- monster_type *m_ptr;
- monster_race *r_ptr;
- bool see_m;
-
- u32b noise; /* Hack -- local "player stealth" value */
-
- /* Handle "leaving" */
- if (p_ptr->leaving) return;
-
- /* Hack -- calculate the "player noise" */
- noise = (1L << (30 - p_ptr->skill_stl));
-
- /* Process the monsters (backwards) */
- for (m_idx = m_max - 1; m_idx >= 1; m_idx--)
- {
- /* Access the monster */
- m_ptr = &m_list[m_idx];
- r_ptr = &r_info[m_ptr->r_idx];
-
- /* Ignore "dead" monsters */
- if (!m_ptr->r_idx) continue;
-
- see_m = is_seen(m_ptr);
-
- /* Handle Invulnerability */
- if (m_ptr->invulner)
- {
- /* Reduce by one, note if expires */
- m_ptr->invulner--;
-
- if (!m_ptr->invulner)
- {
- if (see_m)
- {
- char m_name[80];
-
- /* Acquire the monster name */
- monster_desc(m_name, m_ptr, 0);
-
- /* Dump a message */
-#ifdef JP
- msg_format("%^s¤Ï¤â¤¦ÌµÅ¨¤Ç¤Ê¤¤¡£", m_name);
-#else
- msg_format("%^s is no longer invulnerable.", m_name);
-#endif
- }
- if (m_ptr->ml)
- {
- if (p_ptr->health_who == m_idx) p_ptr->redraw |= (PR_HEALTH);
- if (p_ptr->riding == m_idx) p_ptr->redraw |= (PR_UHEALTH);
- }
- if (!p_ptr->wild_mode) m_ptr->energy_need += ENERGY_NEED();
- }
- }
-
- /* Handle fast */
- if (m_ptr->fast)
- {
- /* Reduce by one, note if expires */
- m_ptr->fast--;
-
- if (!m_ptr->fast)
- {
- if (see_m)
- {
- char m_name[80];
-
- /* Acquire the monster name */
- monster_desc(m_name, m_ptr, 0);
-
- /* Dump a message */
-#ifdef JP
- msg_format("%^s¤Ï¤â¤¦²Ã®¤µ¤ì¤Æ¤¤¤Ê¤¤¡£", m_name);
-#else
- msg_format("%^s is no longer fast.", m_name);
-#endif
- }
- if (p_ptr->riding == m_idx) p_ptr->update |= (PU_BONUS);
- }
- }
-
- /* Handle slow */
- if (m_ptr->slow)
- {
- /* Reduce by one, note if expires */
- m_ptr->slow--;
-
- if (!m_ptr->slow)
- {
- if (see_m)
- {
- char m_name[80];
-
- /* Acquire the monster name */
- monster_desc(m_name, m_ptr, 0);
-
- /* Dump a message */
-#ifdef JP
- msg_format("%^s¤Ï¤â¤¦¸ºÂ®¤µ¤ì¤Æ¤¤¤Ê¤¤¡£", m_name);
-#else
- msg_format("%^s is no longer slow.", m_name);
-#endif
- }
- if (p_ptr->riding == m_idx) p_ptr->update |= (PU_BONUS);
- }
- }
-
- /* Handle "sleep" */
- if (m_ptr->csleep)
- {
- /* Assume does not wake up */
- bool test = FALSE;
-
- /* Hack -- Require proximity */
- if (m_ptr->cdis < AAF_LIMIT)
- {
- /* Handle "sensing radius" */
- if (m_ptr->cdis <= (is_pet(m_ptr) ? ((r_ptr->aaf > MAX_SIGHT) ? MAX_SIGHT : r_ptr->aaf) : r_ptr->aaf))
- {
- /* We may wake up */
- test = TRUE;
- }
-
- /* Handle "sight" and "aggravation" */
- else if ((m_ptr->cdis <= MAX_SIGHT) && (player_has_los_bold(m_ptr->fy, m_ptr->fx)))
- {
- /* We may wake up */
- test = TRUE;
- }
- }
-
- if (test)
- {
- u32b notice = randint0(1024);
-
- /* Nightmare monsters are more alert */
- if (ironman_nightmare) notice /= 2;
-
- /* Hack -- See if monster "notices" player */
- if ((notice * notice * notice) <= noise)
- {
- /* Hack -- amount of "waking" */
- /* Wake up faster near the player */
- int d = (m_ptr->cdis < AAF_LIMIT / 2) ? (AAF_LIMIT / m_ptr->cdis) : 1;
-
- /* Hack -- amount of "waking" is affected by speed of player */
- d = (d * SPEED_TO_ENERGY(p_ptr->pspeed)) / 10;
- if (d < 0) d = 1;
-
- /* Still asleep */
- if (m_ptr->csleep > d)
- {
- /* Monster wakes up "a little bit" */
- m_ptr->csleep -= d;
-
- /* Notice the "not waking up" */
- if (is_original_ap_and_seen(m_ptr))
- {
- /* Hack -- Count the ignores */
- if (r_ptr->r_ignore < MAX_UCHAR) r_ptr->r_ignore++;
- }
- }
-
- /* Just woke up */
- else
- {
- /* Reset sleep counter */
- m_ptr->csleep = 0;
-
- if (r_ptr->flags7 & RF7_HAS_LD_MASK) p_ptr->update |= (PU_MON_LITE);
-
- /* Notice the "waking up" */
- if (see_m)
- {
- char m_name[80];
-
- /* Acquire the monster name */
- monster_desc(m_name, m_ptr, 0);
-
- /* Dump a message */
-#ifdef JP
- msg_format("%^s¤¬Ìܤò³Ð¤Þ¤·¤¿¡£", m_name);
-#else
- msg_format("%^s wakes up.", m_name);
-#endif
- }
-
- if (m_ptr->ml)
- {
- /* Redraw the health bar */
- if (p_ptr->health_who == m_idx) p_ptr->redraw |= (PR_HEALTH);
- if (p_ptr->riding == m_idx) p_ptr->redraw |= (PR_UHEALTH);
-
- /* Hack -- Count the wakings */
- if ((r_ptr->r_wake < MAX_UCHAR) && is_original_ap(m_ptr))
- {
- r_ptr->r_wake++;
- }
- }
- }
- }
- }
- }
-
- /* Handle "stun" */
- if (m_ptr->stunned)
- {
- int d = 1;
-
- /* Make a "saving throw" against stun */
- if (randint0(10000) <= r_ptr->level * r_ptr->level)
- {
- /* Recover fully */
- d = m_ptr->stunned;
- }
-
- /* Hack -- Recover from stun */
- if (m_ptr->stunned > d)
- {
- /* Recover somewhat */
- m_ptr->stunned -= d;
- }
-
- /* Fully recover */
- else
- {
- /* Recover fully */
- m_ptr->stunned = 0;
-
- /* Message if visible */
- if (see_m)
- {
- char m_name[80];
-
- /* Acquire the monster name */
- monster_desc(m_name, m_ptr, 0);
-
- /* Dump a message */
-#ifdef JP
- msg_format("%^s¤ÏÛ¯Û°¾õÂÖ¤«¤éΩ¤Áľ¤Ã¤¿¡£", m_name);
-#else
- msg_format("%^s is no longer stunned.", m_name);
-#endif
- }
- }
- }
-
- /* Handle confusion */
- if (m_ptr->confused)
- {
- /* Amount of "boldness" */
- int d = randint1(r_ptr->level / 20 + 1);
-
- /* Still confused */
- if (m_ptr->confused > d)
- {
- /* Reduce the confusion */
- m_ptr->confused -= d;
- }
-
- /* Recovered */
- else
- {
- /* No longer confused */
- m_ptr->confused = 0;
-
- /* Message if visible */
- if (see_m)
- {
- char m_name[80];
-
- /* Acquire the monster name */
- monster_desc(m_name, m_ptr, 0);
-
- /* Dump a message */
-#ifdef JP
- msg_format("%^s¤Ïº®Í𤫤éΩ¤Áľ¤Ã¤¿¡£", m_name);
-#else
- msg_format("%^s is no longer confused.", m_name);
-#endif
- }
- }
- }
-
- /* Handle "fear" */
- if (m_ptr->monfear)
- {
- /* Amount of "boldness" */
- int d = randint1(r_ptr->level / 20 + 1);
-
- /* Still afraid */
- if (m_ptr->monfear > d)
- {
- /* Reduce the fear */
- m_ptr->monfear -= d;
- }
-
- /* Recover from fear, take note if seen */
- else
- {
- /* No longer afraid */
- m_ptr->monfear = 0;
-
- /* Visual note */
- if (see_m)
- {
- char m_name[80];
-#ifndef JP
- char m_poss[80];
-
- /* Acquire the monster possessive */
- monster_desc(m_poss, m_ptr, MD_PRON_VISIBLE | MD_POSSESSIVE);
-#endif
-
- /* Acquire the monster name */
- monster_desc(m_name, m_ptr, 0);
-
- /* Dump a message */
-#ifdef JP
- msg_format("%^s¤Ïͦµ¤¤ò¼è¤êÌᤷ¤¿¡£", m_name);
-#else
- msg_format("%^s recovers %s courage.", m_name, m_poss);
-#endif
- }
- if (m_ptr->ml)
- {
- if (p_ptr->health_who == m_idx) p_ptr->redraw |= (PR_HEALTH);
- if (p_ptr->riding == m_idx) p_ptr->redraw |= (PR_UHEALTH);
- }
- }
- }
- }
-}
-
-
static void notice_lite_change(object_type *o_ptr)
{
/* Hack -- notice interesting fuel steps */
{
quest[leaving_quest].status = QUEST_STATUS_FAILED;
quest[leaving_quest].complev = (byte)p_ptr->lev;
- if (quest[leaving_quest].type == QUEST_TYPE_RANDOM)
+
+ /* Additional settings */
+ switch (quest[leaving_quest].type)
{
+ case QUEST_TYPE_TOWER:
+ quest[QUEST_TOWER1].status = QUEST_STATUS_FAILED;
+ quest[QUEST_TOWER1].complev = (byte)p_ptr->lev;
+ break;
+ case QUEST_TYPE_FIND_ARTIFACT:
+ a_info[quest[leaving_quest].type].gen_flags &= ~(TRG_QUESTITEM);
+ break;
+ case QUEST_TYPE_RANDOM:
r_info[quest[leaving_quest].r_idx].flags1 &= ~(RF1_QUESTOR);
- if (record_rand_quest)
- do_cmd_write_nikki(NIKKI_RAND_QUEST_F, leaving_quest, NULL);
/* Floor of random quest will be blocked */
prepare_change_floor_mode(CFM_NO_RETURN);
+ break;
+ }
+
+ /* Record finishing a quest */
+ if (quest[leaving_quest].type == QUEST_TYPE_RANDOM)
+ {
+ if (record_rand_quest) do_cmd_write_nikki(NIKKI_RAND_QUEST_F, leaving_quest, NULL);
+ }
+ else
+ {
+ if (record_fix_quest) do_cmd_write_nikki(NIKKI_FIX_QUEST_F, leaving_quest, NULL);
+ }
+ }
+}
+
+void leave_tower_check(void)
+{
+ leaving_quest = p_ptr->inside_quest;
+ /* Check for Tower Quest */
+ if (leaving_quest &&
+ (quest[leaving_quest].type == QUEST_TYPE_TOWER) &&
+ (quest[QUEST_TOWER1].status != QUEST_STATUS_COMPLETED))
+ {
+ if(quest[leaving_quest].type == QUEST_TYPE_TOWER)
+ {
+ quest[QUEST_TOWER1].status = QUEST_STATUS_FAILED;
+ quest[QUEST_TOWER1].complev = (byte)p_ptr->lev;
}
- else if (record_fix_quest)
- do_cmd_write_nikki(NIKKI_FIX_QUEST_F, leaving_quest, NULL);
}
}
/* "Inscribe" it */
o_ptr->feeling = feel;
+ /* Player touches it */
+ o_ptr->marked |= OM_TOUCHED;
+
/* Combine / Reorder the pack (later) */
p_ptr->notice |= (PN_COMBINE | PN_REORDER);
}
-static void gere_music(s32b music)
-{
- switch(music)
- {
- case MUSIC_SLOW:
- slow_monsters();
- break;
- case MUSIC_STUN:
- stun_monsters(damroll(p_ptr->lev/10,2));
- break;
- case MUSIC_L_LIFE:
- hp_player(damroll(2,6));
- break;
- case MUSIC_FEAR:
- project_hack(GF_TURN_ALL, p_ptr->lev);
- break;
- case MUSIC_PSI:
- project_hack(GF_PSI, randint1(p_ptr->lev * 3 / 2));
- break;
- case MUSIC_ID:
- project(0, 1, py, px, 0, GF_IDENTIFY, PROJECT_ITEM, -1);
- break;
- case MUSIC_CONF:
- confuse_monsters(p_ptr->lev * 2);
- break;
- case MUSIC_SOUND:
- project_hack(GF_SOUND, damroll(10 + p_ptr->lev/5,7));
- break;
- case MUSIC_CHARM:
- charm_monsters(damroll(10 + p_ptr->lev/15,6));
- break;
- case MUSIC_WALL:
- project(0, 0, py, px,
- 0, GF_DISINTEGRATE, PROJECT_KILL | PROJECT_ITEM | PROJECT_HIDE, -1);
- break;
- case MUSIC_DISPEL:
- dispel_monsters(randint1(p_ptr->lev * 3));
- dispel_evil(randint1(p_ptr->lev * 3));
- break;
- case MUSIC_SARUMAN:
- slow_monsters();
- sleep_monsters();
- break;
- case MUSIC_QUAKE:
- earthquake(py, px, 10);
- break;
- case MUSIC_STASIS:
- stasis_monsters(p_ptr->lev * 4);
- break;
- case MUSIC_SHERO:
- dispel_monsters(randint1(p_ptr->lev * 3));
- break;
- case MUSIC_H_LIFE:
- hp_player(damroll(15,10));
- set_stun(0);
- set_cut(0);
- break;
- case MUSIC_DETECT+19:
- wiz_lite(FALSE);
- case MUSIC_DETECT+11:
- case MUSIC_DETECT+12:
- case MUSIC_DETECT+13:
- case MUSIC_DETECT+14:
- case MUSIC_DETECT+15:
- case MUSIC_DETECT+16:
- case MUSIC_DETECT+17:
- case MUSIC_DETECT+18:
- map_area(DETECT_RAD_MAP);
- if ((p_ptr->lev > 39) && (music < MUSIC_DETECT+19)) p_ptr->magic_num1[0] = music+1;
- case MUSIC_DETECT+6:
- case MUSIC_DETECT+7:
- case MUSIC_DETECT+8:
- case MUSIC_DETECT+9:
- case MUSIC_DETECT+10:
- /* There are too many hidden treasure. So... */
- /* detect_treasure(DETECT_RAD_DEFAULT); */
- detect_objects_gold(DETECT_RAD_DEFAULT);
- detect_objects_normal(DETECT_RAD_DEFAULT);
- if ((p_ptr->lev > 24) && (music < MUSIC_DETECT+11)) p_ptr->magic_num1[0] = music+1;
- case MUSIC_DETECT+3:
- case MUSIC_DETECT+4:
- case MUSIC_DETECT+5:
- detect_monsters_invis(DETECT_RAD_DEFAULT);
- detect_monsters_normal(DETECT_RAD_DEFAULT);
- if ((p_ptr->lev > 19) && (music < MUSIC_DETECT+6)) p_ptr->magic_num1[0] = music+1;
- case MUSIC_DETECT:
- case MUSIC_DETECT+1:
- case MUSIC_DETECT+2:
- detect_traps(DETECT_RAD_DEFAULT, TRUE);
- detect_doors(DETECT_RAD_DEFAULT);
- detect_stairs(DETECT_RAD_DEFAULT);
- if ((p_ptr->lev > 14) && (music < MUSIC_DETECT+3)) p_ptr->magic_num1[0] = music+1;
- break;
- }
-}
-
/*
* If player has inscribed the object with "!!", let him know when it's
* recharged. -LM-
else if(p_ptr->spell_exp[spell] < SPELL_EXP_MASTER)
{ if (one_in_(5) && ((dun_level + 5) > p_ptr->lev) && (dun_level > s_ptr->slevel)) p_ptr->spell_exp[spell] += 1; }
- gere_music(p_ptr->magic_num1[0]);
+ /* Do any effects of continual song */
+ do_spell(REALM_MUSIC, spell, SPELL_CONT);
}
#endif
(void)set_shero(10 + randint1(p_ptr->lev), FALSE);
+ (void)set_afraid(0);
}
if ((p_ptr->muta2 & MUT2_COWARDICE) && (randint1(3000) == 13))
#endif
msg_print(NULL);
- teleport_player(40, TRUE);
+ teleport_player(40, TELEPORT_PASSIVE);
}
}
msg_print(NULL);
if (one_in_(3)) lose_all_info();
else wiz_dark();
- teleport_player(100, TRUE);
+ (void)teleport_player_aux(100, TELEPORT_NONMAGICAL | TELEPORT_PASSIVE);
wiz_dark();
#ifdef JP
msg_print("¤¢¤Ê¤¿¤Ï¸«ÃΤé¤Ì¾ì½ê¤ÇÌܤ¬Àä᤿...Ƭ¤¬Äˤ¤¡£");
msg_print(NULL);
set_food(PY_FOOD_WEAK);
+ if (music_singing_any()) stop_singing();
+ if (hex_spelling_any()) stop_hex_spell_all();
}
if ((p_ptr->muta2 & MUT2_WALK_SHAD) &&
if (slot && !object_is_cursed(o_ptr))
{
#ifdef JP
- msg_print("Éð´ï¤òÍ¤Æ¤·¤Þ¤Ã¤¿¡ª");
+ msg_print("Éð´ï¤òÍî¤Ȥ·¤Æ¤·¤Þ¤Ã¤¿¡ª");
#else
msg_print("You drop your weapon!");
#endif
{
char o_name[MAX_NLEN];
object_type *o_ptr;
- int i;
+ int i, i_keep = 0, count = 0;
/* Scan the equipment with random teleport ability */
for (i = INVEN_RARM; i < INVEN_TOTAL; i++)
{
u32b flgs[TR_FLAG_SIZE];
o_ptr = &inventory[i];
-
+
/* Skip non-objects */
if (!o_ptr->k_idx) continue;
-
+
/* Extract the item flags */
object_flags(o_ptr, flgs);
-
- if (have_flag(flgs, TR_TELEPORT)) break;
+
+ if (have_flag(flgs, TR_TELEPORT))
+ {
+ /* {.} will stop random teleportation. */
+ if (!o_ptr->inscription || !my_strchr(quark_str(o_ptr->inscription), '.'))
+ {
+ count++;
+ if (one_in_(count)) i_keep = i;
+ }
+ }
}
+ o_ptr = &inventory[i_keep];
object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
#ifdef JP
#endif
{
disturb(0, 0);
- teleport_player(50, FALSE);
+ teleport_player(50, 0L);
}
else
{
disturb(0, 0);
/* Teleport player */
- teleport_player(40, TRUE);
+ teleport_player(40, TELEPORT_PASSIVE);
}
/* Handle HP draining */
if ((p_ptr->cursed & TRC_DRAIN_HP) && one_in_(666))
take_hit(DAMAGE_LOSELIFE, MIN(p_ptr->lev*2, 100), o_name, -1);
}
/* Handle mana draining */
- if ((p_ptr->cursed & TRC_DRAIN_MANA) && one_in_(666))
+ if ((p_ptr->cursed & TRC_DRAIN_MANA) && p_ptr->csp && one_in_(666))
{
char o_name[MAX_NLEN];
msg_print("You feel yourself yanked upwards!");
#endif
- p_ptr->recall_dungeon = dungeon_type;
+ if (dungeon_type) p_ptr->recall_dungeon = dungeon_type;
if (record_stair)
do_cmd_write_nikki(NIKKI_RECALL, dun_level, NULL);
dungeon_type = 0;
leave_quest_check();
+ leave_tower_check();
p_ptr->inside_quest = 0;
*/
prepare_change_floor_mode(CFM_FIRST_FLOOR);
- /* Leaving */
- p_ptr->leaving = TRUE;
+ /* Leaving */
+ p_ptr->leaving = TRUE;
+
+ if (dungeon_type == DUNGEON_ANGBAND)
+ {
+ int i;
+
+ for (i = MIN_RANDOM_QUEST; i < MAX_RANDOM_QUEST + 1; i++)
+ {
+ if ((quest[i].type == QUEST_TYPE_RANDOM) &&
+ (quest[i].status == QUEST_STATUS_TAKEN) &&
+ (quest[i].level < dun_level))
+ {
+ quest[i].status = QUEST_STATUS_FAILED;
+ quest[i].complev = (byte)p_ptr->lev;
+ r_info[quest[i].r_idx].flags1 &= ~(RF1_QUESTOR);
+ }
+ }
+ }
+ }
+
+ /* Sound */
+ sound(SOUND_TPLEVEL);
+ }
+ }
+
+
+ /* Delayed Alter reality */
+ if (p_ptr->alter_reality)
+ {
+ if (autosave_l && (p_ptr->alter_reality == 1) && !p_ptr->inside_battle)
+ do_cmd_save_game(TRUE);
+
+ /* Count down towards alter */
+ p_ptr->alter_reality--;
+
+ p_ptr->redraw |= (PR_STATUS);
+
+ /* Activate the alter reality */
+ if (!p_ptr->alter_reality)
+ {
+ /* Disturbing! */
+ disturb(0, 0);
+
+ /* Determine the level */
+ if (!quest_number(dun_level) && dun_level)
+ {
+#ifdef JP
+ msg_print("À¤³¦¤¬ÊѤï¤Ã¤¿¡ª");
+#else
+ msg_print("The world changes!");
+#endif
+
+ /*
+ * Clear all saved floors
+ * and create a first saved floor
+ */
+ prepare_change_floor_mode(CFM_FIRST_FLOOR);
+
+ /* Leaving */
+ p_ptr->leaving = TRUE;
+ }
+ else
+ {
+#ifdef JP
+ msg_print("À¤³¦¤¬¾¯¤·¤Î´ÖÊѲ½¤·¤¿¤è¤¦¤À¡£");
+#else
+ msg_print("The world seems to change for a moment!");
+#endif
+ }
+
+ /* Sound */
+ sound(SOUND_TPLEVEL);
+ }
+ }
+}
+
+
+/*
+ * Count number of adjacent monsters
+ */
+static int get_monster_crowd_number(int m_idx)
+{
+ monster_type *m_ptr = &m_list[m_idx];
+ int my = m_ptr->fy;
+ int mx = m_ptr->fx;
+ int i;
+ int count = 0;
+
+ for (i = 0; i < 7; i++)
+ {
+ int ay = my + ddy_ddd[i];
+ int ax = mx + ddx_ddd[i];
+
+ if (!in_bounds(ay, ax)) continue;
+
+ /* Count number of monsters */
+ if (cave[ay][ax].m_idx > 0) count++;
+ }
+
+ return count;
+}
+
+
+
+/*
+ * Dungeon rating is no longer linear
+ */
+#define RATING_BOOST(delta) (delta * delta + 50 * delta)
+
+/*
+ * Examine all monsters and unidentified objects,
+ * and get the feeling of current dungeon floor
+ */
+static byte get_dungeon_feeling(void)
+{
+ const int base = 10;
+ int rating = 0;
+ int i;
+
+ /* Hack -- no feeling in the town */
+ if (!dun_level) return 0;
+
+ /* Examine each monster */
+ for (i = 1; i < m_max; i++)
+ {
+ monster_type *m_ptr = &m_list[i];
+ monster_race *r_ptr;
+ int delta = 0;
+
+ /* Skip dead monsters */
+ if (!m_ptr->r_idx) continue;
+
+ /* Ignore pet */
+ if (is_pet(m_ptr)) continue;
+
+ r_ptr = &r_info[m_ptr->r_idx];
+
+ /* Unique monsters */
+ if (r_ptr->flags1 & (RF1_UNIQUE))
+ {
+ /* Nearly out-of-depth unique monsters */
+ if (r_ptr->level + 10 > dun_level)
+ {
+ /* Boost rating by twice delta-depth */
+ delta += (r_ptr->level + 10 - dun_level) * 2 * base;
+ }
+ }
+ else
+ {
+ /* Out-of-depth monsters */
+ if (r_ptr->level > dun_level)
+ {
+ /* Boost rating by delta-depth */
+ delta += (r_ptr->level - dun_level) * base;
+ }
+ }
+
+ /* Unusually crowded monsters get a little bit of rating boost */
+ if (r_ptr->flags1 & RF1_FRIENDS)
+ {
+ if (5 <= get_monster_crowd_number(i)) delta += 1;
+ }
+ else
+ {
+ if (2 <= get_monster_crowd_number(i)) delta += 1;
+ }
+
+
+ rating += RATING_BOOST(delta);
+ }
+
+ /* Examine each unidentified object */
+ for (i = 1; i < o_max; i++)
+ {
+ object_type *o_ptr = &o_list[i];
+ object_kind *k_ptr = &k_info[o_ptr->k_idx];
+ int delta = 0;
+
+ /* Skip dead objects */
+ if (!o_ptr->k_idx) continue;
+
+ /* Skip known objects */
+ if (object_is_known(o_ptr))
+ {
+ /* Touched? */
+ if (o_ptr->marked & OM_TOUCHED) continue;
+ }
+
+ /* Skip pseudo-known objects */
+ if (o_ptr->ident & IDENT_SENSE) continue;
+
+ /* Ego objects */
+ if (object_is_ego(o_ptr))
+ {
+ ego_item_type *e_ptr = &e_info[o_ptr->name2];
+
+ delta += e_ptr->rating * base;
+ }
+
+ /* Artifacts */
+ if (object_is_artifact(o_ptr))
+ {
+ s32b cost = object_value_real(o_ptr);
- if (dungeon_type == DUNGEON_ANGBAND)
- {
- int i;
+ delta += 10 * base;
+ if (cost > 10000L) delta += 10 * base;
+ if (cost > 50000L) delta += 10 * base;
+ if (cost > 100000L) delta += 10 * base;
- for (i = MIN_RANDOM_QUEST; i < MAX_RANDOM_QUEST + 1; i++)
- {
- if ((quest[i].type == QUEST_TYPE_RANDOM) &&
- (quest[i].status == QUEST_STATUS_TAKEN) &&
- (quest[i].level < dun_level))
- {
- quest[i].status = QUEST_STATUS_FAILED;
- quest[i].complev = (byte)p_ptr->lev;
- r_info[quest[i].r_idx].flags1 &= ~(RF1_QUESTOR);
- }
- }
- }
- }
+ /* Special feeling */
+ if (!preserve_mode) return 1;
+ }
- /* Sound */
- sound(SOUND_TPLEVEL);
+ if (o_ptr->tval == TV_DRAG_ARMOR) delta += 30 * base;
+ if (o_ptr->tval == TV_SHIELD &&
+ o_ptr->sval == SV_DRAGON_SHIELD) delta += 5 * base;
+ if (o_ptr->tval == TV_GLOVES &&
+ o_ptr->sval == SV_SET_OF_DRAGON_GLOVES) delta += 5 * base;
+ if (o_ptr->tval == TV_BOOTS &&
+ o_ptr->sval == SV_PAIR_OF_DRAGON_GREAVE) delta += 5 * base;
+ if (o_ptr->tval == TV_HELM &&
+ o_ptr->sval == SV_DRAGON_HELM) delta += 5 * base;
+ if (o_ptr->tval == TV_RING &&
+ o_ptr->sval == SV_RING_SPEED &&
+ !object_is_cursed(o_ptr)) delta += 25 * base;
+ if (o_ptr->tval == TV_RING &&
+ o_ptr->sval == SV_RING_LORDLY &&
+ !object_is_cursed(o_ptr)) delta += 15 * base;
+ if (o_ptr->tval == TV_AMULET &&
+ o_ptr->sval == SV_AMULET_THE_MAGI &&
+ !object_is_cursed(o_ptr)) delta += 15 * base;
+
+ /* Out-of-depth objects */
+ if (!object_is_cursed(o_ptr) && !object_is_broken(o_ptr) &&
+ k_ptr->level > dun_level)
+ {
+ /* Rating increase */
+ delta += (k_ptr->level - dun_level) * base;
}
+
+ rating += RATING_BOOST(delta);
}
- /* Delayed Alter reality */
- if (p_ptr->alter_reality)
- {
- if (autosave_l && (p_ptr->alter_reality == 1) && !p_ptr->inside_battle)
- do_cmd_save_game(TRUE);
+ if (rating > RATING_BOOST(1000)) return 2;
+ if (rating > RATING_BOOST(800)) return 3;
+ if (rating > RATING_BOOST(600)) return 4;
+ if (rating > RATING_BOOST(400)) return 5;
+ if (rating > RATING_BOOST(300)) return 6;
+ if (rating > RATING_BOOST(200)) return 7;
+ if (rating > RATING_BOOST(100)) return 8;
+ if (rating > RATING_BOOST(0)) return 9;
- /* Count down towards alter */
- p_ptr->alter_reality--;
+ return 10;
+}
- p_ptr->redraw |= (PR_STATUS);
- /* Activate the alter reality */
- if (!p_ptr->alter_reality)
- {
- /* Disturbing! */
- disturb(0, 0);
+/*
+ * Update dungeon feeling, and announce it if changed
+ */
+static void update_dungeon_feeling(void)
+{
+ byte new_feeling;
+ int quest_num;
+ int delay;
- /* Determine the level */
- if (!quest_number(dun_level) && dun_level)
- {
-#ifdef JP
- msg_print("À¤³¦¤¬ÊѤï¤Ã¤¿¡ª");
-#else
- msg_print("The world changes!");
-#endif
+ /* No feeling on the surface */
+ if (!dun_level) return;
- /* Leaving */
- p_ptr->leaving = TRUE;
- }
- else
- {
-#ifdef JP
- msg_print("À¤³¦¤¬¾¯¤·¤Î´ÖÊѲ½¤·¤¿¤è¤¦¤À¡£");
-#else
- msg_print("The world seems to change for a moment!");
-#endif
- }
+ /* No feeling in the arena */
+ if (p_ptr->inside_battle) return;
- /* Sound */
- sound(SOUND_TPLEVEL);
- }
- }
+ /* Extract delay time */
+ delay = MAX(10, 150 - p_ptr->skill_fos) * (150 - dun_level) * TURNS_PER_TICK / 100;
+
+ /* Not yet felt anything */
+ if (turn < p_ptr->feeling_turn + delay && !cheat_xtra) return;
+
+ /* Extract quest number (if any) */
+ quest_num = quest_number(dun_level);
+
+ /* No feeling in a quest */
+ if (quest_num &&
+ (is_fixed_quest_idx(quest_num) &&
+ !((quest_num == QUEST_OBERON) || (quest_num == QUEST_SERPENT) ||
+ !(quest[quest_num].flags & QUEST_FLAG_PRESET)))) return;
+
+
+ /* Get new dungeon feeling */
+ new_feeling = get_dungeon_feeling();
+
+ /* Remember last time updated */
+ p_ptr->feeling_turn = turn;
+
+ /* No change */
+ if (p_ptr->feeling == new_feeling) return;
+
+ /* Dungeon feeling is changed */
+ p_ptr->feeling = new_feeling;
+
+ /* Announce feeling */
+ do_cmd_feeling();
+
+ /* Update the level indicator */
+ p_ptr->redraw |= (PR_DEPTH);
+
+ /* Disturb */
+ if (disturb_minor) disturb(0, 0);
}
extract_day_hour_min(&day, &hour, &min);
-
- if ((turn - old_turn == (150 - dun_level) * TURNS_PER_TICK)
- && dun_level && !p_ptr->inside_battle)
- {
- int quest_num = quest_number(dun_level);
-
- /* Get dungeon level feeling */
- if (!(quest_num &&
- (is_fixed_quest_idx(quest_num) &&
- !((quest_num == QUEST_OBERON) || (quest_num == QUEST_SERPENT) ||
- !(quest[quest_num].flags & QUEST_FLAG_PRESET)))))
- {
- /* Announce feeling */
- do_cmd_feeling();
-
- /* Update the level indicator */
- p_ptr->redraw |= (PR_DEPTH);
-
- /* Disturb */
- if (disturb_minor) disturb(0, 0);
- }
- }
+ /* Update dungeon feeling, and announce it if changed */
+ update_dungeon_feeling();
/*** Check monster arena ***/
if (p_ptr->inside_battle && !p_ptr->leaving)
p_ptr->energy_need = 0;
battle_monsters();
}
- else if(turn - old_turn == 150*TURNS_PER_TICK)
+ else if (turn - old_turn == 150*TURNS_PER_TICK)
{
#ifdef JP
msg_print("¿½¤·Ê¬¤±¤¢¤ê¤Þ¤»¤ó¤¬¡¢¤³¤Î¾¡Éé¤Ï°ú¤Ê¬¤±¤È¤µ¤»¤Æ¤¤¤¿¤À¤¤Þ¤¹¡£");
do_cmd_save_game(TRUE);
}
- if (mon_fight)
+ if (mon_fight && !ignore_unview)
{
#ifdef JP
msg_print("²¿¤«¤¬Ê¹¤³¤¨¤¿¡£");
if (!have_flag(f_ptr->flags, FF_STORE)) continue;
/* Verify store type */
- if (f_ptr->power == n)
+ if (f_ptr->subtype == n)
{
/* Message */
#ifdef JP
if (!(turn % (TURNS_PER_TICK*10)) && !p_ptr->inside_battle) regen_monsters();
if (!(turn % (TURNS_PER_TICK*3))) regen_captured_monsters();
- /* Hack -- Process the counters of all monsters */
- process_monsters_counters();
+ if (!p_ptr->leaving)
+ {
+ int i;
+
+ /* Hack -- Process the counters of monsters if needed */
+ for (i = 0; i < MAX_MTIMED; i++)
+ {
+ if (mproc_max[i] > 0) process_monsters_mtimed(i);
+ }
+ }
/* Date changes */
}
}
- /* TY_CURSE activates at mignight! */
+ /* TY_CURSE activates at midnight! */
if (!hour && !min)
{
int count = 0;
now_message = 0;
+ /* Sniper */
+ if ((p_ptr->pclass == CLASS_SNIPER) && (p_ptr->concent))
+ reset_concent = TRUE;
+
/* Parse the command */
switch (command_cmd)
{
do_cmd_kaji(TRUE);
else if (p_ptr->pclass == CLASS_MAGIC_EATER)
do_cmd_magic_eater(TRUE);
+ else if (p_ptr->pclass == CLASS_SNIPER)
+ do_cmd_snipe_browse();
else do_cmd_browse();
break;
}
do_cmd_cast_learned();
else if (p_ptr->pclass == CLASS_SMITH)
do_cmd_kaji(FALSE);
+ else if (p_ptr->pclass == CLASS_SNIPER)
+ do_cmd_snipe();
else
do_cmd_cast();
}
case '=':
{
do_cmd_options();
+ (void)combine_and_reorder_home(STORE_HOME);
do_cmd_redraw();
break;
}
break;
}
+ /* Record/stop "Movie" */
+ case ']':
+ {
+ prepare_movie_hooks();
+ break;
+ }
+
/* Make random artifact list */
case KTRL('V'):
{
break;
}
+#ifdef TRAVEL
+ case '`':
+ {
+ if (!p_ptr->wild_mode) do_cmd_travel();
+ if (p_ptr->special_defense & KATA_MUSOU)
+ {
+ set_action(ACTION_NONE);
+ }
+ break;
+ }
+#endif
+
/* Hack -- Unknown command */
default:
{
}
+/* Hack -- Pack Overflow */
+static void pack_overflow(void)
+{
+ if (inventory[INVEN_PACK].k_idx)
+ {
+ char o_name[MAX_NLEN];
+ object_type *o_ptr;
+
+ /* Is auto-destroy done? */
+ notice_stuff();
+ if (!inventory[INVEN_PACK].k_idx) return;
+
+ /* Access the slot to be dropped */
+ o_ptr = &inventory[INVEN_PACK];
+
+ /* Disturbing */
+ disturb(0, 0);
+
+ /* Warning */
+#ifdef JP
+ msg_print("¥¶¥Ã¥¯¤«¤é¥¢¥¤¥Æ¥à¤¬¤¢¤Õ¤ì¤¿¡ª");
+#else
+ msg_print("Your pack overflows!");
+#endif
+
+ /* Describe */
+ object_desc(o_name, o_ptr, 0);
+
+ /* Message */
+#ifdef JP
+ msg_format("%s(%c)¤òÍî¤È¤·¤¿¡£", o_name, index_to_label(INVEN_PACK));
+#else
+ msg_format("You drop %s (%c).", o_name, index_to_label(INVEN_PACK));
+#endif
+
+ /* Drop it (carefully) near the player */
+ (void)drop_near(o_ptr, 0, py, px);
+
+ /* Modify, Describe, Optimize */
+ inven_item_increase(INVEN_PACK, -255);
+ inven_item_describe(INVEN_PACK);
+ inven_item_optimize(INVEN_PACK);
+
+ /* Handle "p_ptr->notice" */
+ notice_stuff();
+
+ /* Handle "p_ptr->update" and "p_ptr->redraw" and "p_ptr->window" */
+ handle_stuff();
+ }
+}
+
+
/*
* Process the player
*
monster_type *m_ptr = &m_list[p_ptr->riding];
monster_race *r_ptr = &r_info[m_ptr->r_idx];
- if (m_ptr->csleep)
+ if (MON_CSLEEP(m_ptr))
{
char m_name[80];
/* Recover fully */
- m_ptr->csleep = 0;
-
- if (r_ptr->flags7 & RF7_HAS_LD_MASK) p_ptr->update |= (PU_MON_LITE);
+ (void)set_monster_csleep(p_ptr->riding, 0);
/* Acquire the monster name */
monster_desc(m_name, m_ptr, 0);
#else
msg_format("You have waked %s up.", m_name);
#endif
- p_ptr->redraw |= (PR_UHEALTH);
}
- if (m_ptr->stunned)
+ if (MON_STUNNED(m_ptr))
{
- int d = 1;
-
- /* Make a "saving throw" against stun */
- if (randint0(r_ptr->level) < p_ptr->skill_exp[GINOU_RIDING])
- {
- /* Recover fully */
- d = m_ptr->stunned;
- }
-
/* Hack -- Recover from stun */
- if (m_ptr->stunned > d)
- {
- /* Recover somewhat */
- m_ptr->stunned -= d;
- }
-
- /* Fully recover */
- else
+ if (set_monster_stunned(p_ptr->riding,
+ (randint0(r_ptr->level) < p_ptr->skill_exp[GINOU_RIDING]) ? 0 : (MON_STUNNED(m_ptr) - 1)))
{
char m_name[80];
- /* Recover fully */
- m_ptr->stunned = 0;
-
/* Acquire the monster name */
monster_desc(m_name, m_ptr, 0);
}
}
- if (m_ptr->confused)
+ if (MON_CONFUSED(m_ptr))
{
- int d = 1;
-
- /* Make a "saving throw" against stun */
- if (randint0(r_ptr->level) < p_ptr->skill_exp[GINOU_RIDING])
- {
- /* Recover fully */
- d = m_ptr->confused;
- }
-
- /* Hack -- Recover from stun */
- if (m_ptr->confused > d)
- {
- /* Recover somewhat */
- m_ptr->confused -= d;
- }
-
- /* Fully recover */
- else
+ /* Hack -- Recover from confusion */
+ if (set_monster_confused(p_ptr->riding,
+ (randint0(r_ptr->level) < p_ptr->skill_exp[GINOU_RIDING]) ? 0 : (MON_CONFUSED(m_ptr) - 1)))
{
char m_name[80];
- /* Recover fully */
- m_ptr->confused = 0;
-
/* Acquire the monster name */
monster_desc(m_name, m_ptr, 0);
}
}
- if (m_ptr->monfear)
+ if (MON_MONFEAR(m_ptr))
{
- int d = 1;
-
- /* Make a "saving throw" against stun */
- if (randint0(r_ptr->level) < p_ptr->skill_exp[GINOU_RIDING])
- {
- /* Recover fully */
- d = m_ptr->monfear;
- }
-
- /* Hack -- Recover from stun */
- if (m_ptr->monfear > d)
- {
- /* Recover somewhat */
- m_ptr->monfear -= d;
- }
-
- /* Fully recover */
- else
+ /* Hack -- Recover from fear */
+ if (set_monster_monfear(p_ptr->riding,
+ (randint0(r_ptr->level) < p_ptr->skill_exp[GINOU_RIDING]) ? 0 : (MON_MONFEAR(m_ptr) - 1)))
{
char m_name[80];
- /* Recover fully */
- m_ptr->monfear = 0;
-
/* Acquire the monster name */
monster_desc(m_name, m_ptr, 0);
#else
msg_format("%^s is no longer fear.", m_name);
#endif
- p_ptr->redraw |= (PR_UHEALTH);
}
}
/* Handle the player song */
if (!load) check_music();
+ /* Hex - Handle the hex spells */
+ if (!load) check_hex();
+ if (!load) revenge_spell();
+
load = FALSE;
/* Fast */
/* Hack -- Pack Overflow */
- if (inventory[INVEN_PACK].k_idx)
- {
- int item = INVEN_PACK;
-
- char o_name[MAX_NLEN];
-
- object_type *o_ptr;
-
- /* Access the slot to be dropped */
- o_ptr = &inventory[item];
-
- /* Disturbing */
- disturb(0, 0);
-
- /* Warning */
-#ifdef JP
-msg_print("¥¶¥Ã¥¯¤«¤é¥¢¥¤¥Æ¥à¤¬¤¢¤Õ¤ì¤¿¡ª");
-#else
- msg_print("Your pack overflows!");
-#endif
-
-
- /* Describe */
- object_desc(o_name, o_ptr, 0);
-
- /* Message */
-#ifdef JP
-msg_format("%s(%c)¤òÍî¤È¤·¤¿¡£", o_name, index_to_label(item));
-#else
- msg_format("You drop %s (%c).", o_name, index_to_label(item));
-#endif
-
-
- /* Drop it (carefully) near the player */
- (void)drop_near(o_ptr, 0, py, px);
-
- /* Modify, Describe, Optimize */
- inven_item_increase(item, -255);
- inven_item_describe(item);
- inven_item_optimize(item);
-
- /* Handle "p_ptr->notice" */
- notice_stuff();
-
- /* Handle "p_ptr->update" and "p_ptr->redraw" and "p_ptr->window" */
- handle_stuff();
- }
+ pack_overflow();
/* Hack -- cancel "lurking browse mode" */
run_step(0);
}
+#ifdef TRAVEL
+ /* Traveling */
+ else if (travel.run)
+ {
+ /* Take a step */
+ travel_step();
+ }
+#endif
+
/* Repeated command */
else if (command_rep)
{
}
+ /* Hack -- Pack Overflow */
+ pack_overflow();
+
+
/*** Clean up ***/
/* Significant */
}
}
new_mane = FALSE;
- p_ptr->redraw |= (PR_MANE);
+ p_ptr->redraw |= (PR_IMITATION);
}
if (p_ptr->action == ACTION_LEARN)
{
break;
}
+ /* Sniper */
+ if (energy_use && reset_concent) reset_concentration(TRUE);
+
/* Handle "leaving" */
if (p_ptr->leaving) break;
}
if (record_maxdepth) do_cmd_write_nikki(NIKKI_MAXDEAPTH, dun_level, NULL);
}
+ (void)calculate_upkeep();
+
/* Validate the panel */
panel_bounds_center();
/* Not leaving dungeon */
p_ptr->leaving_dungeon = FALSE;
+ /* Initialize monster process */
+ mproc_init();
+
/* Main loop */
while (TRUE)
{
/* Count game turns */
turn++;
- if (!p_ptr->wild_mode || wild_regen) dungeon_turn++;
- else if (p_ptr->wild_mode && !(turn % ((MAX_HGT + MAX_WID) / 2))) dungeon_turn++;
+
+ if (dungeon_turn < dungeon_turn_limit)
+ {
+ if (!p_ptr->wild_mode || wild_regen) dungeon_turn++;
+ else if (p_ptr->wild_mode && !(turn % ((MAX_HGT + MAX_WID) / 2))) dungeon_turn++;
+ }
+
+ prevent_turn_overflow();
+
if (wild_regen) wild_regen--;
}
}
#endif
+ if (browsing_movie)
+ {
+ reset_visuals();
+ browse_movie();
+ return;
+ }
+
hack_mutation = FALSE;
/* Hack -- Character is "icky" */
quit(0);
}
+ creating_savefile = new_game;
+
/* Nothing loaded */
if (!character_loaded)
{
determine_bounty_uniques();
determine_today_mon(FALSE);
+
+ /* Initialize object array */
+ wipe_o_list();
}
else
{
}
}
+ creating_savefile = FALSE;
+
p_ptr->teleport_town = FALSE;
p_ptr->sutemi = FALSE;
world_monster = FALSE;
/* Flavor the objects */
flavor_init();
- if (new_game)
- {
- wipe_o_list();
- player_outfit();
- }
/* Flash a message */
#ifdef JP
/* Load the "pref" files */
load_all_pref_files();
+ /* Give startup outfit (after loading pref files) */
+ if (new_game)
+ {
+ player_outfit();
+ }
+
/* React to changes */
Term_xtra(TERM_XTRA_REACT, 0);
m_ptr->energy_need = ENERGY_NEED() + ENERGY_NEED();
}
+ (void)combine_and_reorder_home(STORE_HOME);
+ (void)combine_and_reorder_home(STORE_MUSEUM);
+
/* Process */
while (TRUE)
{
/* Handle "p_ptr->notice" */
notice_stuff();
+ /* Hack -- prevent "icky" message */
+ character_xtra = TRUE;
+
/* Handle "p_ptr->update" and "p_ptr->redraw" and "p_ptr->window" */
handle_stuff();
+ character_xtra = FALSE;
+
/* Cancel the target */
target_who = 0;
{
/* Mega-Hack -- Allow player to cheat death */
#ifdef JP
-if ((p_ptr->wizard || cheat_live) && !get_check("»à¤Ë¤Þ¤¹¤«? "))
+ if ((p_ptr->wizard || cheat_live) && !get_check("»à¤Ë¤Þ¤¹¤«? "))
#else
if ((p_ptr->wizard || cheat_live) && !get_check("Die? "))
#endif
-
{
/* Mark social class, reset age, if needed */
if (p_ptr->sc) p_ptr->sc = p_ptr->age = 0;
/* Message */
#ifdef JP
-msg_print("¥¦¥£¥¶¡¼¥É¥â¡¼¥É¤ËÇ°¤òÁ÷¤ê¡¢»à¤òµ½¤¤¤¿¡£");
+ msg_print("¥¦¥£¥¶¡¼¥É¥â¡¼¥É¤ËÇ°¤òÁ÷¤ê¡¢»à¤òµ½¤¤¤¿¡£");
#else
msg_print("You invoke wizard mode and cheat death.");
#endif
- wipe_m_list();
-
msg_print(NULL);
/* Restore hit points */
{
/* Message */
#ifdef JP
-msg_print("Ä¥¤ê¤Ä¤á¤¿Â絤¤¬Î®¤ìµî¤Ã¤¿...");
+ msg_print("Ä¥¤ê¤Ä¤á¤¿Â絤¤¬Î®¤ìµî¤Ã¤¿...");
#else
msg_print("A tension leaves the air around you...");
#endif
p_ptr->inside_battle = FALSE;
leaving_quest = 0;
p_ptr->inside_quest = 0;
- p_ptr->recall_dungeon = dungeon_type;
+ if (dungeon_type) p_ptr->recall_dungeon = dungeon_type;
dungeon_type = 0;
if (lite_town || vanilla_town)
{
/* Leaving */
p_ptr->wild_mode = FALSE;
-
p_ptr->leaving = TRUE;
#ifdef JP
#else
do_cmd_write_nikki(NIKKI_BUNSHOU, 1, " but revived.");
#endif
+
+ /* Prepare next floor */
+ leave_floor();
+ wipe_m_list();
}
}
}
return hoge;
}
}
+
+/*
+ * ¥¿¡¼¥ó¤Î¥ª¡¼¥Ð¡¼¥Õ¥í¡¼¤ËÂФ¹¤ëÂнè
+ * ¥¿¡¼¥óµÚ¤Ó¥¿¡¼¥ó¤òµÏ¿¤¹¤ëÊÑ¿ô¤ò¥¿¡¼¥ó¤Î¸Â³¦¤Î1ÆüÁ°¤Þ¤Ç´¬¤Ì᤹.
+ */
+void prevent_turn_overflow(void)
+{
+ int rollback_days, i, j;
+ s32b rollback_turns;
+
+ if (turn < turn_limit) return;
+
+ rollback_days = 1 + (turn - turn_limit) / (TURNS_PER_TICK * TOWN_DAWN);
+ rollback_turns = TURNS_PER_TICK * TOWN_DAWN * rollback_days;
+
+ if (turn > rollback_turns) turn -= rollback_turns;
+ else turn = 1; /* Paranoia */
+ if (old_turn > rollback_turns) old_turn -= rollback_turns;
+ else old_turn = 1;
+ if (old_battle > rollback_turns) old_battle -= rollback_turns;
+ else old_battle = 1;
+ if (p_ptr->feeling_turn > rollback_turns) p_ptr->feeling_turn -= rollback_turns;
+ else p_ptr->feeling_turn = 1;
+
+ for (i = 1; i < max_towns; i++)
+ {
+ for (j = 0; j < MAX_STORES; j++)
+ {
+ store_type *st_ptr = &town[i].store[j];
+
+ if (st_ptr->last_visit > -10L * TURNS_PER_TICK * STORE_TICKS)
+ {
+ st_ptr->last_visit -= rollback_turns;
+ if (st_ptr->last_visit < -10L * TURNS_PER_TICK * STORE_TICKS) st_ptr->last_visit = -10L * TURNS_PER_TICK * STORE_TICKS;
+ }
+
+ if (st_ptr->store_open)
+ {
+ st_ptr->store_open -= rollback_turns;
+ if (st_ptr->store_open < 1) st_ptr->store_open = 1;
+ }
+ }
+ }
+}