OSDN Git Service

This commit was manufactured by cvs2svn to create tag
[hengbandforosx/hengbandosx.git] / src / spells2.c
index ae955da..e2b71e5 100644 (file)
@@ -749,7 +749,7 @@ info[i++] = "
                        break;
                case CLASS_BEASTMASTER:
 #ifdef JP
-info[i++] = "¤¢¤Ê¤¿¤Ï1ɤ¤ÎÀ¸Ì¿¤Î¤¢¤ë¥â¥ó¥¹¥¿¡¼¤ò»ÙÇÛ¤¹¤ë¤³¤È¤¬¤Ç¤­¤ë¡£(¥ì¥Ù¥ë/4 MP)";
+info[i++] = "¤¢¤Ê¤¿¤Ï1ÂΤÎÀ¸Ì¿¤Î¤¢¤ë¥â¥ó¥¹¥¿¡¼¤ò»ÙÇÛ¤¹¤ë¤³¤È¤¬¤Ç¤­¤ë¡£(¥ì¥Ù¥ë/4 MP)";
 #else
                        info[i++] = "You can dominate a monster (cost level/4).";
 #endif
@@ -4156,14 +4156,17 @@ bool detect_monsters_evil(int range)
                /* Detect evil monsters */
                if (r_ptr->flags3 & RF3_EVIL)
                {
-                       /* Take note that they are evil */
-                       r_ptr->r_flags3 |= (RF3_EVIL);
-
-                       /* Update monster recall window */
-                       if (p_ptr->monster_race_idx == m_ptr->r_idx)
+                       if (is_original_ap(m_ptr))
                        {
-                               /* Window stuff */
-                               p_ptr->window |= (PW_MONSTER);
+                               /* Take note that they are evil */
+                               r_ptr->r_flags3 |= (RF3_EVIL);
+
+                               /* Update monster recall window */
+                               if (p_ptr->monster_race_idx == m_ptr->r_idx)
+                               {
+                                       /* Window stuff */
+                                       p_ptr->window |= (PW_MONSTER);
+                               }
                        }
 
                        /* Repair visibility later */
@@ -4436,14 +4439,17 @@ cptr desc_monsters = "
                /* Detect evil monsters */
                if (r_ptr->flags3 & (match_flag))
                {
-                       /* Take note that they are something */
-                       r_ptr->r_flags3 |= (match_flag);
-
-                       /* Update monster recall window */
-                       if (p_ptr->monster_race_idx == m_ptr->r_idx)
+                       if (is_original_ap(m_ptr))
                        {
-                               /* Window stuff */
-                               p_ptr->window |= (PW_MONSTER);
+                               /* Take note that they are something */
+                               r_ptr->r_flags3 |= (match_flag);
+
+                               /* Update monster recall window */
+                               if (p_ptr->monster_race_idx == m_ptr->r_idx)
+                               {
+                                       /* Window stuff */
+                                       p_ptr->window |= (PW_MONSTER);
+                               }
                        }
 
                        /* Repair visibility later */
@@ -4718,6 +4724,7 @@ void aggravate_monsters(int who)
                        {
                                /* Wake up */
                                m_ptr->csleep = 0;
+                               if (r_info[m_ptr->r_idx].flags7 & RF7_HAS_LD_MASK) p_ptr->update |= (PU_MON_LITE);
                                sleep = TRUE;
                        }
                        if (!is_pet(m_ptr)) m_ptr->mflag2 |= MFLAG2_NOPET;
@@ -4758,7 +4765,7 @@ bool symbol_genocide(int power, int player_cast)
        int     msec = delay_factor * delay_factor * delay_factor;
 
        /* Prevent genocide in quest levels */
-       if (p_ptr->inside_quest && !random_quest_number(dun_level))
+       if ((p_ptr->inside_quest && !random_quest_number(dun_level)) || p_ptr->inside_arena || p_ptr->inside_battle)
        {
                return (FALSE);
        }
@@ -4818,6 +4825,7 @@ msg_format("%^s
                        if (m_ptr->csleep)
                        {
                                m_ptr->csleep = 0;
+                               if (r_ptr->flags7 & RF7_HAS_LD_MASK) p_ptr->update |= (PU_MON_LITE);
                                if (m_ptr->ml && !p_ptr->blind)
                                {
 #ifdef JP
@@ -4895,7 +4903,7 @@ bool mass_genocide(int power, int player_cast)
 
 
        /* Prevent mass genocide in quest levels */
-       if (p_ptr->inside_quest && !random_quest_number(dun_level))
+       if ((p_ptr->inside_quest && !random_quest_number(dun_level)) || p_ptr->inside_arena || p_ptr->inside_battle)
        {
                return (FALSE);
        }
@@ -4947,6 +4955,7 @@ msg_format("%^s
                        if (m_ptr->csleep)
                        {
                                m_ptr->csleep = 0;
+                               if (r_ptr->flags7 & RF7_HAS_LD_MASK) p_ptr->update |= (PU_MON_LITE);
                                if (m_ptr->ml && !p_ptr->blind)
                                {
 #ifdef JP
@@ -5025,7 +5034,7 @@ bool mass_genocide_undead(int power, int player_cast)
 
 
        /* Prevent mass genocide in quest levels */
-       if (p_ptr->inside_quest && !random_quest_number(dun_level))
+       if ((p_ptr->inside_quest && !random_quest_number(dun_level)) || p_ptr->inside_arena || p_ptr->inside_battle)
        {
                return (FALSE);
        }
@@ -5079,6 +5088,7 @@ msg_format("%^s
                        if (m_ptr->csleep)
                        {
                                m_ptr->csleep = 0;
+                               if (r_ptr->flags7 & RF7_HAS_LD_MASK) p_ptr->update |= (PU_MON_LITE);
                                if (m_ptr->ml && !p_ptr->blind)
                                {
 #ifdef JP
@@ -5109,7 +5119,7 @@ msg_format("%^s
 #ifdef JP
 take_hit(DAMAGE_GENO, randint1(3), "¥¢¥ó¥Ç¥Ã¥É¾ÃÌǤμöʸ¤ò¾§¤¨¤¿ÈèÏ«", -1);
 #else
-                       take_hit(DAMAGE_GENO, randint1(3), "the strain of casting Mass Genocide", -1);
+                       take_hit(DAMAGE_GENO, randint1(3), "the strain of casting Annihilate Undead", -1);
 #endif
 
                }
@@ -5208,18 +5218,18 @@ bool probing(void)
 
                        /* Get the monster's alignment */
 #ifdef JP
-                       if ((r_ptr->flags3 & RF3_EVIL) && (r_ptr->flags3 & RF3_GOOD)) align = "Á±°­";
+                       if ((r_ptr->flags3 & (RF3_EVIL | RF3_GOOD)) == (RF3_EVIL | RF3_GOOD)) align = "Á±°­";
                        else if (r_ptr->flags3 & RF3_EVIL) align = "¼Ù°­";
                        else if (r_ptr->flags3 & RF3_GOOD) align = "Á±ÎÉ";
-                       else if ((m_ptr->sub_align & SUB_ALIGN_EVIL) && (m_ptr->sub_align & SUB_ALIGN_GOOD)) align = "ÃæΩ(Á±°­)";
+                       else if ((m_ptr->sub_align & (SUB_ALIGN_EVIL | SUB_ALIGN_GOOD)) == (SUB_ALIGN_EVIL | SUB_ALIGN_GOOD)) align = "ÃæΩ(Á±°­)";
                        else if (m_ptr->sub_align & SUB_ALIGN_EVIL) align = "ÃæΩ(¼Ù°­)";
                        else if (m_ptr->sub_align & SUB_ALIGN_GOOD) align = "ÃæΩ(Á±ÎÉ)";
                        else align = "ÃæΩ";
 #else
-                       if ((r_ptr->flags3 & RF3_EVIL) && (r_ptr->flags3 & RF3_GOOD)) align = "good&evil";
+                       if ((r_ptr->flags3 & (RF3_EVIL | RF3_GOOD)) == (RF3_EVIL | RF3_GOOD)) align = "good&evil";
                        else if (r_ptr->flags3 & RF3_EVIL) align = "evil";
                        else if (r_ptr->flags3 & RF3_GOOD) align = "good";
-                       else if ((m_ptr->sub_align & SUB_ALIGN_EVIL) && (m_ptr->sub_align & SUB_ALIGN_GOOD)) align = "neutral(good&evil)";
+                       else if ((m_ptr->sub_align & (SUB_ALIGN_EVIL | SUB_ALIGN_GOOD)) == (SUB_ALIGN_EVIL | SUB_ALIGN_GOOD)) align = "neutral(good&evil)";
                        else if (m_ptr->sub_align & SUB_ALIGN_EVIL) align = "neutral(evil)";
                        else if (m_ptr->sub_align & SUB_ALIGN_GOOD) align = "neutral(good)";
                        else align = "neutral";
@@ -5269,15 +5279,15 @@ sprintf(buf, "%s ... align:%s HP:%d/%d AC:%d speed:%s%d exp:", m_name, align, m_
                        /* Learn everything about this monster */
                        if (lore_do_probe(m_ptr->r_idx))
                        {
-#ifdef JP
-                               /* Note that we learnt some new flags  -Mogami- */
-                               msg_format("%s¤Ë¤Ä¤¤¤Æ¤µ¤é¤Ë¾Ü¤·¤¯¤Ê¤Ã¤¿µ¤¤¬¤¹¤ë¡£", m_name);
-#else
                                char buf[80];
 
                                /* Get base name of monster */
                                strcpy(buf, (r_name + r_ptr->name));
 
+#ifdef JP
+                               /* Note that we learnt some new flags  -Mogami- */
+                               msg_format("%s¤Ë¤Ä¤¤¤Æ¤µ¤é¤Ë¾Ü¤·¤¯¤Ê¤Ã¤¿µ¤¤¬¤¹¤ë¡£", buf);
+#else
                                /* Pluralize it */
                                plural_aux(buf);
 
@@ -5336,6 +5346,9 @@ bool destroy_area(int y1, int x1, int r, bool in_generate)
                return (FALSE);
        }
 
+       /* Lose monster light */
+       clear_mon_lite();
+
        /* Big area of affect */
        for (y = (y1 - r); y <= (y1 + r); y++)
        {
@@ -5362,7 +5375,7 @@ bool destroy_area(int y1, int x1, int r, bool in_generate)
                        if (!in_generate) /* Normal */
                        {
                                /* Lose unsafety and runes/mirrors */
-                               c_ptr->info &= ~(CAVE_UNSAFE | CAVE_OBJECT);
+                               c_ptr->info &= ~(CAVE_UNSAFE);
 
                                /* Hack -- Notice player affect */
                                if (player_bold(y, x))
@@ -5370,13 +5383,22 @@ bool destroy_area(int y1, int x1, int r, bool in_generate)
                                        /* Hurt the player later */
                                        flag = TRUE;
 
+                                       /* Process "re-glowing" */
+                                       if (is_mirror_grid(c_ptr)) c_ptr->info |= CAVE_GLOW;
+
                                        /* Do not hurt this grid */
                                        continue;
                                }
                        }
 
                        /* Hack -- Skip the epicenter */
-                       if ((y == y1) && (x == x1)) continue;
+                       if ((y == y1) && (x == x1))
+                       {
+                               /* Process "re-glowing" */
+                               if (!in_generate && is_mirror_grid(c_ptr)) c_ptr->info |= CAVE_GLOW;
+
+                               continue;
+                       }
 
                        if (c_ptr->m_idx)
                        {
@@ -5394,7 +5416,13 @@ bool destroy_area(int y1, int x1, int r, bool in_generate)
                                        m_ptr->hp = m_ptr->maxhp;
 
                                        /* Try to teleport away quest monsters */
-                                       if (!teleport_away(c_ptr->m_idx, (r * 2) + 1, TRUE)) continue;
+                                       if (!teleport_away(c_ptr->m_idx, (r * 2) + 1, TRUE))
+                                       {
+                                               /* Process "re-glowing" */
+                                               if (is_mirror_grid(c_ptr)) c_ptr->info |= CAVE_GLOW;
+
+                                               continue;
+                                       }
                                }
                                else
                                {
@@ -5632,10 +5660,22 @@ bool earthquake(int cy, int cx, int r)
                        c_ptr->info &= ~(CAVE_GLOW | CAVE_MARK);
 
                        /* Skip the epicenter */
-                       if (!dx && !dy) continue;
+                       if (!dx && !dy)
+                       {
+                               /* Process "re-glowing" */
+                               if (is_mirror_grid(c_ptr)) c_ptr->info |= CAVE_GLOW;
+
+                               continue;
+                       }
 
                        /* Skip most grids */
-                       if (randint0(100) < 85) continue;
+                       if (randint0(100) < 85)
+                       {
+                               /* Process "re-glowing" */
+                               if (is_mirror_grid(c_ptr)) c_ptr->info |= CAVE_GLOW;
+
+                               continue;
+                       }
 
                        /* Damage this grid */
                        map[16+yy-cy][16+xx-cx] = TRUE;
@@ -5963,6 +6003,8 @@ msg_format("%^s
                }
        }
 
+       /* Lose monster light */
+       clear_mon_lite();
 
        /* Examine the quaked region */
        for (dy = -r; dy <= r; dy++)
@@ -5990,9 +6032,6 @@ msg_format("%^s
                                /* Delete objects */
                                delete_object(yy, xx);
 
-                               /* Clear mirror, runes flag */
-                               c_ptr->info &= ~CAVE_OBJECT;
-
                                /* Wall (or floor) type */
                                t = (floor ? randint0(100) : 200);
 
@@ -6099,7 +6138,7 @@ void discharge_minion(void)
                if (dam > 800) dam = 800;
                project(i, 2+(r_ptr->level/20), m_ptr->fy,
                        m_ptr->fx, dam, GF_PLASMA, 
-                       PROJECT_STOP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_MONSTER, -1);
+                       PROJECT_STOP | PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL, -1);
                delete_monster_idx(i);
        }
 }
@@ -6165,6 +6204,8 @@ static void cave_temp_room_lite(void)
                                /* Wake up! */
                                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)
                                {
@@ -6415,6 +6456,11 @@ void lite_room(int y1, int x1)
 
        /* Now, lite them all up at once */
        cave_temp_room_lite();
+
+       if (p_ptr->special_defense & NINJA_S_STEALTH)
+       {
+               if (cave[py][px].info & CAVE_GLOW) set_superstealth(FALSE);
+       }
 }
 
 
@@ -6490,11 +6536,6 @@ msg_print("
        /* Lite up the room */
        lite_room(py, px);
 
-       if (p_ptr->special_defense & NINJA_S_STEALTH)
-       {
-               set_superstealth(FALSE);
-       }
-
        /* Assume seen */
        return (TRUE);
 }
@@ -6750,7 +6791,7 @@ msg_print("
        m_ptr = &m_list[c_ptr->m_idx];
        r_ptr = &r_info[m_ptr->r_idx];
 
-       if (r_ptr->flags3 & RF3_RES_TELE)
+       if (r_ptr->flagsr & RFR_RES_TELE)
        {
 #ifdef JP
 msg_print("¥Æ¥ì¥Ý¡¼¥È¤ò¼ÙË⤵¤ì¤¿¡ª");
@@ -6758,7 +6799,11 @@ msg_print("
                msg_print("Your teleportation is blocked!");
 #endif
 
+               if (m_ptr->ml && is_original_ap(m_ptr)) r_ptr->r_flagsr |= RFR_RES_TELE;
+
                m_ptr->csleep = 0;
+               if (r_ptr->flags7 & RF7_HAS_LD_MASK) p_ptr->update |= (PU_MON_LITE);
+
                /* Failure */
                return FALSE;
        }
@@ -6852,9 +6897,9 @@ bool project_hook(int typ, int dir, int dam, int flg)
 
 
 /*
- * Cast a bolt spell
- * Stop if we hit a monster, as a "bolt"
- * Affect monsters (not grids or objects)
+ * Cast a bolt spell.
+ * Stop if we hit a monster, as a "bolt".
+ * Affect monsters and grids (not objects).
  */
 bool fire_bolt(int typ, int dir, int dam)
 {
@@ -6864,9 +6909,9 @@ bool fire_bolt(int typ, int dir, int dam)
 
 
 /*
- * Cast a beam spell
- * Pass through monsters, as a "beam"
- * Affect monsters (not grids or objects)
+ * Cast a beam spell.
+ * Pass through monsters, as a "beam".
+ * Affect monsters, grids and objects.
  */
 bool fire_beam(int typ, int dir, int dam)
 {
@@ -7629,3 +7674,154 @@ void kawarimi(bool success)
        p_ptr->special_defense &= ~(NINJA_KAWARIMI);
        p_ptr->redraw |= (PR_STATUS);
 }
+
+
+/*
+ * "Rush Attack" routine for Samurai or Ninja
+ * Return value is for checking "done"
+ */
+bool rush_attack(bool *mdeath)
+{
+       int dir;
+       int tx, ty;
+       int tm_idx = 0;
+       u16b path_g[32];
+       int path_n, i;
+       bool tmp_mdeath = FALSE;
+       bool moved = FALSE;
+
+       if (mdeath) *mdeath = FALSE;
+
+       project_length = 5;
+       if (!get_aim_dir(&dir)) return FALSE;
+
+       /* Use the given direction */
+       tx = px + project_length * ddx[dir];
+       ty = py + project_length * ddy[dir];
+
+       /* Hack -- Use an actual "target" */
+       if ((dir == 5) && target_okay())
+       {
+               tx = target_col;
+               ty = target_row;
+       }
+
+       if (in_bounds(ty, tx)) tm_idx = cave[ty][tx].m_idx;
+
+       path_n = project_path(path_g, project_length, py, px, ty, tx, PROJECT_STOP | PROJECT_KILL);
+       project_length = 0;
+
+       /* No need to move */
+       if (!path_n) return TRUE;
+
+       /* Use ty and tx as to-move point */
+       ty = py;
+       tx = px;
+
+       /* Project along the path */
+       for (i = 0; i < path_n; i++)
+       {
+               monster_type *m_ptr;
+
+               int ny = GRID_Y(path_g[i]);
+               int nx = GRID_X(path_g[i]);
+
+               if (cave_empty_bold(ny, nx) && player_can_enter(cave[ny][nx].feat))
+               {
+                       ty = ny;
+                       tx = nx;
+
+                       /* Go to next grid */
+                       continue;
+               }
+
+               if (!cave[ny][nx].m_idx)
+               {
+                       if (tm_idx)
+                       {
+#ifdef JP
+                               msg_print("¼ºÇÔ¡ª");
+#else
+                               msg_print("Failed!");
+#endif
+                       }
+                       else
+                       {
+#ifdef JP
+                               msg_print("¤³¤³¤Ë¤ÏÆþ¿È¤Ç¤ÏÆþ¤ì¤Ê¤¤¡£");
+#else
+                               msg_print("You can't move to that place.");
+#endif
+                       }
+
+                       /* Exit loop */
+                       break;
+               }
+
+               /* Move player before updating the monster */
+               if (!player_bold(ty, tx)) teleport_player_to(ty, tx, FALSE);
+
+               /* Update the monster */
+               update_mon(cave[ny][nx].m_idx, TRUE);
+
+               /* Found a monster */
+               m_ptr = &m_list[cave[ny][nx].m_idx];
+
+               if (tm_idx != cave[ny][nx].m_idx)
+               {
+#ifdef JP
+                       msg_format("%s%s¤¬Î©¤Á¤Õ¤µ¤¬¤Ã¤Æ¤¤¤ë¡ª", tm_idx ? "Ê̤Î" : "",
+                                  m_ptr->ml ? "¥â¥ó¥¹¥¿¡¼" : "²¿¤«");
+#else
+                       msg_format("There is %s in the way!", m_ptr->ml ? (tm_idx ? "another monster" : "a monster") : "someone");
+#endif
+               }
+               else if (!player_bold(ty, tx))
+               {
+                       /* Hold the monster name */
+                       char m_name[80];
+
+                       /* Get the monster name (BEFORE polymorphing) */
+                       monster_desc(m_name, m_ptr, 0);
+#ifdef JP
+                       msg_format("ÁÇÁ᤯%s¤Î²û¤ËÆþ¤ê¹þ¤ó¤À¡ª", m_name);
+#else
+                       msg_format("You quickly jump in and attack %s!", m_name);
+#endif
+               }
+
+               if (!player_bold(ty, tx)) teleport_player_to(ty, tx, FALSE);
+               moved = TRUE;
+               tmp_mdeath = py_attack(ny, nx, HISSATSU_NYUSIN);
+
+               break;
+       }
+
+       if (!moved && !player_bold(ty, tx)) teleport_player_to(ty, tx, FALSE);
+
+       if (mdeath) *mdeath = tmp_mdeath;
+       return TRUE;
+}
+
+
+/*
+ * Remove all mirrors in this floor
+ */
+void remove_all_mirrors(bool explode)
+{
+       int x, y;
+
+       for (x = 0; x < cur_wid; x++)
+       {
+               for (y = 0; y < cur_hgt; y++)
+               {
+                       if (is_mirror_grid(&cave[y][x]))
+                       {
+                               remove_mirror(y, x);
+                               if (explode)
+                                       project(0, 2, y, x, p_ptr->lev / 2 + 5, GF_SHARDS,
+                                               (PROJECT_GRID | PROJECT_ITEM | PROJECT_KILL | PROJECT_JUMP | PROJECT_NO_HANGEKI), -1);
+                       }
+               }
+       }
+}