OSDN Git Service

一般形のナズグルに与えられるフラグUNIQUE_7をNAZGULと置き換えた. この
[hengband/hengband.git] / src / dungeon.c
index 5ec9ad4..35bb9cf 100644 (file)
@@ -1206,8 +1206,7 @@ static void process_monsters_counters(void)
                                }
 
                                /* Handle "sight" and "aggravation" */
-                               else if ((m_ptr->cdis <= MAX_SIGHT) &&
-                                       (player_has_los_bold(m_ptr->fy, m_ptr->fx) || (p_ptr->cursed & TRC_AGGRAVATE)))
+                               else if ((m_ptr->cdis <= MAX_SIGHT) && (player_has_los_bold(m_ptr->fy, m_ptr->fx)))
                                {
                                        /* We may wake up */
                                        test = TRUE;
@@ -1216,10 +1215,7 @@ static void process_monsters_counters(void)
 
                        if (test)
                        {
-                               u32b notice = 0;
-
-                               /* Hack -- handle non-aggravation */
-                               if (!(p_ptr->cursed & TRC_AGGRAVATE)) notice = randint0(1024);
+                               u32b notice = randint0(1024);
 
                                /* Nightmare monsters are more alert */
                                if (ironman_nightmare) notice /= 2;
@@ -1228,22 +1224,12 @@ static void process_monsters_counters(void)
                                if ((notice * notice * notice) <= noise)
                                {
                                        /* Hack -- amount of "waking" */
-                                       int d = 1;
+                                       /* Wake up faster near the player */
+                                       int d = (m_ptr->cdis < AAF_LIMIT / 2) ? (AAF_LIMIT / m_ptr->cdis) : 1;
 
-                                       /* Hack -- handle aggravation */
-                                       if (p_ptr->cursed & TRC_AGGRAVATE)
-                                       {
-                                               d = m_ptr->csleep;
-                                       }
-                                       else
-                                       {
-                                               /* Wake up faster near the player */
-                                               if (m_ptr->cdis < AAF_LIMIT / 2) d = (AAF_LIMIT / m_ptr->cdis);
-
-                                               /* Hack -- amount of "waking" is affected by speed of player */
-                                               d = (d * SPEED_TO_ENERGY(p_ptr->pspeed)) / 10;
-                                               if (d < 0) d = 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)
@@ -1268,6 +1254,8 @@ static void process_monsters_counters(void)
                                                /* 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 (m_ptr->ml)
                                                {
@@ -1287,9 +1275,6 @@ static void process_monsters_counters(void)
                                                        if (p_ptr->health_who == m_idx) p_ptr->redraw |= (PR_HEALTH);
                                                        if (p_ptr->riding == m_idx) p_ptr->redraw |= (PR_UHEALTH);
 
-                                                       if (r_ptr->flags7 & (RF7_HAS_LITE_1 | RF7_HAS_LITE_2))
-                                                               p_ptr->update |= (PU_MON_LITE);
-
                                                        /* Hack -- Count the wakings */
                                                        if (r_ptr->r_wake < MAX_UCHAR)
                                                        {
@@ -1410,11 +1395,15 @@ static void process_monsters_counters(void)
                                if (m_ptr->ml)
                                {
                                        char m_name[80];
+#ifndef JP
                                        char m_poss[80];
 
-                                       /* Acquire the monster name/poss */
+                                       /* 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);
-                                       monster_desc(m_poss, m_ptr, 0x22);
 
                                        /* Dump a message */
 #ifdef JP
@@ -2095,12 +2084,11 @@ msg_print("
                        {
                                /* Message */
 #ifdef JP
-msg_print("Ì뤬ÌÀ¤±¤¿¡£");
+                               msg_print("Ì뤬ÌÀ¤±¤¿¡£");
 #else
                                msg_print("The sun has risen.");
 #endif
 
-
                                /* Hack -- Scan the town */
                                for (y = 0; y < cur_hgt; y++)
                                {
@@ -2124,14 +2112,15 @@ msg_print("
                        /* Night falls */
                        else
                        {
+                               byte feat;
+
                                /* Message */
 #ifdef JP
-msg_print("Æü¤¬ÄÀ¤ó¤À¡£");
+                               msg_print("Æü¤¬ÄÀ¤ó¤À¡£");
 #else
                                msg_print("The sun has fallen.");
 #endif
 
-
                                /* Hack -- Scan the town */
                                for (y = 0; y < cur_hgt; y++)
                                {
@@ -2140,24 +2129,27 @@ msg_print("
                                                /* Get the cave grid */
                                                c_ptr = &cave[y][x];
 
-                                               /* Darken "boring" features */
-                                               if ((c_ptr->feat <= FEAT_INVIS) ||
-                                                   ((c_ptr->feat >= FEAT_DEEP_WATER) &&
-                                                       (c_ptr->feat <= FEAT_MOUNTAIN) &&
-                                                    (c_ptr->feat != FEAT_MUSEUM)) ||
-                                                   (x == 0) || (x == cur_wid-1) ||
-                                                   (y == 0) || (y == cur_hgt-1))
+                                               /* Feature code (applying "mimic" field) */
+                                               feat = f_info[c_ptr->mimic ? c_ptr->mimic : c_ptr->feat].mimic;
+
+                                               if (!is_mirror_grid(c_ptr) && (feat != FEAT_QUEST_ENTER) && (feat != FEAT_ENTRANCE))
                                                {
-                                                       /* Forget the grid */
-                                                       if (!is_mirror_grid(c_ptr)) c_ptr->info &= ~(CAVE_GLOW | CAVE_MARK);
+                                                       /* Assume dark */
+                                                       c_ptr->info &= ~(CAVE_GLOW);
 
-                                                       /* Hack -- Notice spot */
-                                                       note_spot(y, x);
+                                                       if ((feat <= FEAT_INVIS) || (feat == FEAT_DIRT) || (feat == FEAT_GRASS))
+                                                       {
+                                                               /* Forget the normal floor grid */
+                                                               c_ptr->info &= ~(CAVE_MARK);
+
+                                                               /* Hack -- Notice spot */
+                                                               note_spot(y, x);
+                                                       }
                                                }
                                        }
 
-                                       /* Glow deep lava */
-                                       glow_deep_lava();
+                                       /* Glow deep lava and building entrances */
+                                       glow_deep_lava_and_bldg();
                                }
                        }
 
@@ -2232,7 +2224,7 @@ if (cheat_xtra) msg_print("
        {
                if (!dun_level && !p_ptr->resist_lite && !IS_INVULN() && is_daytime())
                {
-                       if (cave[py][px].info & CAVE_GLOW)
+                       if ((cave[py][px].info & (CAVE_GLOW | CAVE_MNDK)) == CAVE_GLOW)
                        {
                                /* Take damage */
 #ifdef JP
@@ -2464,39 +2456,10 @@ dam_desc = "
 
        if (!hour && !min)
        {
-               monster_race *r_ptr;
-
                if (min != prev_min)
                {
-                       int max_dl = 3;
-                       bool old_inside_battle = p_ptr->inside_battle;
-
                        do_cmd_write_nikki(NIKKI_HIGAWARI, 0, NULL);
-
-                       p_ptr->inside_battle = TRUE;
-                       get_mon_num_prep(NULL,NULL);
-
-                       for (i = 0; i < max_d_idx; i++)
-                       {
-                               if (max_dlv[i] < d_info[i].mindepth) continue;
-                               if (max_dl < max_dlv[i]) max_dl = max_dlv[i];
-                       }
-                       while (1)
-                       {
-                               today_mon = get_mon_num(max_dl);
-                               r_ptr = &r_info[today_mon];
-
-                               if (r_ptr->flags1 & RF1_UNIQUE) continue;
-                               if (r_ptr->flags7 & (RF7_UNIQUE_7 | RF7_UNIQUE2)) continue;
-                               if (r_ptr->flags2 & (RF2_MULTIPLY)) continue;
-                               if (!(r_ptr->flags9 & RF9_DROP_CORPSE) || !(r_ptr->flags9 & RF9_DROP_SKELETON)) continue;
-                               if (r_ptr->level < MIN(max_dl/2, 40)) continue;
-                               if (r_ptr->rarity > 10) continue;
-                               if (r_ptr->level == 0) continue;
-                               break;
-                       }
-                       p_ptr->today_mon = 0;
-                       p_ptr->inside_battle = old_inside_battle;
+                       determine_today_mon(FALSE);
                }
        }
 
@@ -3404,7 +3367,7 @@ msg_print("
                        msg_print(NULL);
 
                        /* Absorb light from the current possition */
-                       if (cave[py][px].info & CAVE_GLOW)
+                       if ((cave[py][px].info & (CAVE_GLOW | CAVE_MNDK)) == CAVE_GLOW)
                        {
                                hp_player(10);
                        }
@@ -3704,6 +3667,9 @@ msg_print("̵Ũ
 
                                hp_player(healing);
                                p_ptr->csp -= healing;
+
+                               /* Redraw mana */
+                               p_ptr->redraw |= (PR_MANA);
                        }
                }
                if ((p_ptr->muta2 & MUT2_HP_TO_SP) && !p_ptr->anti_magic &&
@@ -3721,6 +3687,9 @@ msg_print("̵Ũ
                                }
 
                                p_ptr->csp += healing;
+
+                               /* Redraw mana */
+                               p_ptr->redraw |= (PR_MANA);
 #ifdef JP
 take_hit(DAMAGE_LOSELIFE, healing, "Ƭ¤Ë¾º¤Ã¤¿·ì", -1);
 #else
@@ -5606,6 +5575,8 @@ msg_print("
                        /* Recover fully */
                        m_ptr->csleep = 0;
 
+                       if (r_info[m_ptr->r_idx].flags7 & RF7_HAS_LD_MASK) p_ptr->update |= (PU_MON_LITE);
+
                        /* Acquire the monster name */
                        monster_desc(m_name, m_ptr, 0);
 #ifdef JP
@@ -6557,6 +6528,95 @@ void extract_option_vars(void)
 
 
 /*
+ * Determine bounty uniques
+ */
+void determine_bounty_uniques(void)
+{
+       int          i, j, tmp;
+       monster_race *r_ptr;
+
+       get_mon_num_prep(NULL, NULL);
+       for (i = 0; i < MAX_KUBI; i++)
+       {
+               while (1)
+               {
+                       kubi_r_idx[i] = get_mon_num(MAX_DEPTH - 1);
+                       r_ptr = &r_info[kubi_r_idx[i]];
+
+                       if (!(r_ptr->flags1 & RF1_UNIQUE)) continue;
+
+                       if (!(r_ptr->flags9 & (RF9_DROP_CORPSE | RF9_DROP_SKELETON))) continue;
+
+                       if (r_ptr->rarity > 100) continue;
+
+                       if (no_questor_or_bounty_uniques(kubi_r_idx[i])) continue;
+
+                       for (j = 0; j < i; j++)
+                               if (kubi_r_idx[i] == kubi_r_idx[j]) break;
+
+                       if (j == i) break;
+               }
+       }
+
+       /* Sort them */
+       for (i = 0; i < MAX_KUBI - 1; i++)
+       {
+               for (j = i; j < MAX_KUBI; j++)
+               {
+                       if (r_info[kubi_r_idx[i]].level > r_info[kubi_r_idx[j]].level)
+                       {
+                               tmp = kubi_r_idx[i];
+                               kubi_r_idx[i] = kubi_r_idx[j];
+                               kubi_r_idx[j] = tmp;
+                       }
+               }
+       }
+}
+
+
+/*
+ * Determine today's bounty monster
+ * Note: conv_old is used if loaded 0.0.3 or older save file
+ */
+void determine_today_mon(bool conv_old)
+{
+       int max_dl = 3, i;
+       bool old_inside_battle = p_ptr->inside_battle;
+       monster_race *r_ptr;
+
+       if (!conv_old)
+       {
+               for (i = 0; i < max_d_idx; i++)
+               {
+                       if (max_dlv[i] < d_info[i].mindepth) continue;
+                       if (max_dl < max_dlv[i]) max_dl = max_dlv[i];
+               }
+       }
+       else max_dl = MAX(max_dlv[DUNGEON_ANGBAND], 3);
+
+       p_ptr->inside_battle = TRUE;
+       get_mon_num_prep(NULL, NULL);
+
+       while (1)
+       {
+               today_mon = get_mon_num(max_dl);
+               r_ptr = &r_info[today_mon];
+
+               if (r_ptr->flags1 & RF1_UNIQUE) continue;
+               if (r_ptr->flags7 & (RF7_NAZGUL | RF7_UNIQUE2)) continue;
+               if (r_ptr->flags2 & RF2_MULTIPLY) continue;
+               if ((r_ptr->flags9 & (RF9_DROP_CORPSE | RF9_DROP_SKELETON)) != (RF9_DROP_CORPSE | RF9_DROP_SKELETON)) continue;
+               if (r_ptr->level < MIN(max_dl / 2, 40)) continue;
+               if (r_ptr->rarity > 10) continue;
+               break;
+       }
+
+       p_ptr->today_mon = 0;
+       p_ptr->inside_battle = old_inside_battle;
+}
+
+
+/*
  * Actually play a game
  *
  * If the "new_game" parameter is true, then, after loading the
@@ -6744,8 +6804,6 @@ quit("
        /* Roll new character */
        if (new_game)
        {
-               monster_race *r_ptr;
-
                /* The dungeon is not ready */
                character_dungeon = FALSE;
 
@@ -6776,57 +6834,9 @@ quit("
 #endif
 
                load = FALSE;
-               get_mon_num_prep(NULL, NULL);
-               for (i = 0; i < MAX_KUBI; i++)
-               {
-                       while (1)
-                       {
-                               int j;
-
-                               kubi_r_idx[i] = get_mon_num(MAX_DEPTH - 1);
-                               r_ptr = &r_info[kubi_r_idx[i]];
-
-                               if(!(r_ptr->flags1 & RF1_UNIQUE)) continue;
 
-                               if(!(r_ptr->flags9 & RF9_DROP_CORPSE)) continue;
-                               if (r_ptr->rarity > 100) continue;
-
-                               if(r_ptr->flags6 & RF6_SPECIAL) continue;
-
-                               for (j = 0; j < i; j++)
-                                       if (kubi_r_idx[i] == kubi_r_idx[j])break;
-
-                               if (j == i) break;
-                       }
-               }
-               for (i = 0; i < MAX_KUBI -1; i++)
-               {
-                       int j,tmp;
-                       for (j = i; j < MAX_KUBI; j++)
-                       {
-                               if (r_info[kubi_r_idx[i]].level > r_info[kubi_r_idx[j]].level)
-                               {
-                                       tmp = kubi_r_idx[i];
-                                       kubi_r_idx[i] = kubi_r_idx[j];
-                                       kubi_r_idx[j] = tmp;
-                               }
-                       }
-               }
-
-               p_ptr->inside_battle = TRUE;
-               while (1)
-               {
-                       today_mon = get_mon_num(3);
-                       r_ptr = &r_info[today_mon];
-
-                       if (r_ptr->flags1 & RF1_UNIQUE) continue;
-                       if (r_ptr->flags2 & (RF2_MULTIPLY)) continue;
-                       if (!(r_ptr->flags9 & RF9_DROP_CORPSE) || !(r_ptr->flags9 & RF9_DROP_SKELETON)) continue;
-                       if (r_ptr->rarity > 10) continue;
-                       if (r_ptr->level == 0) continue;
-                       break;
-               }
-               p_ptr->inside_battle = FALSE;
+               determine_bounty_uniques();
+               determine_today_mon(FALSE);
        }
        else
        {
@@ -6845,9 +6855,9 @@ quit("
                if (p_ptr->riding == -1)
                {
                        p_ptr->riding = 0;
-                       for(i = m_max; i > 0; i--)
+                       for (i = m_max; i > 0; i--)
                        {
-                               if ((m_list[i].fy == py) && (m_list[i].fx == px))
+                               if (player_bold(m_list[i].fy, m_list[i].fx))
                                {
                                        p_ptr->riding = i;
                                        break;
@@ -7022,10 +7032,10 @@ prt("
                        if (p_ptr->inside_arena)
                        {
                                p_ptr->inside_arena = FALSE;
-                               if(p_ptr->arena_number > MAX_ARENA_MONS)
+                               if (p_ptr->arena_number > MAX_ARENA_MONS)
                                        p_ptr->arena_number++;
                                else
-                                       p_ptr->arena_number = 99;
+                                       p_ptr->arena_number = -1 - p_ptr->arena_number;
                                p_ptr->is_dead = FALSE;
                                p_ptr->chp = 0;
                                p_ptr->chp_frac = 0;