OSDN Git Service

切り裂きの大鎌『ブラッディ・ムーン』に関する変更.
[hengband/hengband.git] / src / mspells1.c
index 3d29ace..d4f2694 100644 (file)
@@ -834,7 +834,7 @@ static bool spell_dispel(byte spell)
 /*
  * Check should monster cast dispel spell.
  */
-static bool dispel_check(int m_idx)
+bool dispel_check(int m_idx)
 {
        monster_type *m_ptr = &m_list[m_idx];
        monster_race *r_ptr = &r_info[m_ptr->r_idx];
@@ -1192,6 +1192,48 @@ bool spell_is_inate(u16b spell)
 }
 
 
+static bool adjacent_grid_check(monster_type *m_ptr, int *yp, int *xp,
+       int f_flag, bool (*path_check)(int, int, int, int))
+{
+       int i;
+       int tonari;
+       static int tonari_y[4][8] = {{-1, -1, -1,  0,  0,  1,  1,  1},
+                                            {-1, -1, -1,  0,  0,  1,  1,  1},
+                                            { 1,  1,  1,  0,  0, -1, -1, -1},
+                                            { 1,  1,  1,  0,  0, -1, -1, -1}};
+       static int tonari_x[4][8] = {{-1,  0,  1, -1,  1, -1,  0,  1},
+                                            { 1,  0, -1,  1, -1,  1,  0, -1},
+                                            {-1,  0,  1, -1,  1, -1,  0,  1},
+                                            { 1,  0, -1,  1, -1,  1,  0, -1}};
+
+       if (m_ptr->fy < py && m_ptr->fx < px) tonari = 0;
+       else if (m_ptr->fy < py) tonari = 1;
+       else if (m_ptr->fx < px) tonari = 2;
+       else tonari = 3;
+
+       for (i = 0; i < 8; i++)
+       {
+               int next_x = *xp + tonari_x[tonari][i];
+               int next_y = *yp + tonari_y[tonari][i];
+               cave_type *c_ptr;
+
+               /* Access the next grid */
+               c_ptr = &cave[next_y][next_x];
+
+               /* Skip this feature */
+               if (!cave_have_flag_grid(c_ptr, f_flag)) continue;
+
+               if (path_check(m_ptr->fy, m_ptr->fx, next_y, next_x))
+               {
+                       *yp = next_y;
+                       *xp = next_x;
+                       return TRUE;
+               }
+       }
+
+       return FALSE;
+}
+
 #define DO_SPELL_NONE    0
 #define DO_SPELL_BR_LITE 1
 #define DO_SPELL_BR_DISI 2
@@ -1273,6 +1315,10 @@ bool make_attack_spell(int m_idx)
        int x = px;
        int y = py;
 
+       /* Target location for lite breath */
+       int x_br_lite = 0;
+       int y_br_lite = 0;
+
        /* Summon count */
        int count = 0;
 
@@ -1323,6 +1369,33 @@ bool make_attack_spell(int m_idx)
        /* Check range */
        if ((m_ptr->cdis > MAX_RANGE) && !m_ptr->target_y) return (FALSE);
 
+       /* Check path for lite breath */
+       if (f4 & RF4_BR_LITE)
+       {
+               y_br_lite = y;
+               x_br_lite = x;
+
+               if (los(m_ptr->fy, m_ptr->fx, y_br_lite, x_br_lite))
+               {
+                       feature_type *f_ptr = &f_info[cave[y_br_lite][x_br_lite].feat];
+
+                       if (!have_flag(f_ptr->flags, FF_LOS))
+                       {
+                               if (have_flag(f_ptr->flags, FF_PROJECT) && one_in_(2)) f4 &= ~(RF4_BR_LITE);
+                       }
+               }
+
+               /* Check path to next grid */
+               else if (!adjacent_grid_check(m_ptr, &y_br_lite, &x_br_lite, FF_LOS, los)) f4 &= ~(RF4_BR_LITE);
+
+               /* Don't breath lite to the wall if impossible */
+               if (!(f4 & RF4_BR_LITE))
+               {
+                       y_br_lite = 0;
+                       x_br_lite = 0;
+               }
+       }
+
        /* Check path */
        if (projectable(m_ptr->fy, m_ptr->fx, y, x))
        {
@@ -1351,8 +1424,7 @@ bool make_attack_spell(int m_idx)
                        success = TRUE;
                }
                else if ((f4 & RF4_BR_LITE) && (m_ptr->cdis < MAX_RANGE/2) &&
-                   los(m_ptr->fy, m_ptr->fx, y, x) &&
-                   (one_in_(10) || (projectable(y, x, m_ptr->fy, m_ptr->fx) && one_in_(2))))
+                   los(m_ptr->fy, m_ptr->fx, y, x) && one_in_(5))
                {
                        do_spell = DO_SPELL_BR_LITE;
                        success = TRUE;
@@ -1361,53 +1433,14 @@ bool make_attack_spell(int m_idx)
                {
                        int by = y, bx = x;
                        get_project_point(m_ptr->fy, m_ptr->fx, &by, &bx, 0L);
-                       if ((distance(by, bx, y, x) <= 3) && los(by, bx, y, x) &&
-                           (one_in_(10) || (projectable(y, x, m_ptr->fy, m_ptr->fx) && one_in_(2))))
+                       if ((distance(by, bx, y, x) <= 3) && los(by, bx, y, x) && one_in_(5))
                        {
                                do_spell = DO_SPELL_BA_LITE;
                                success = TRUE;
                        }
                }
 
-               if (!success)
-               {
-                       int i;
-                       int tonari;
-                       int tonari_y[4][8] = {{-1,-1,-1,0,0,1,1,1},
-                                             {-1,-1,-1,0,0,1,1,1},
-                                             {1,1,1,0,0,-1,-1,-1},
-                                             {1,1,1,0,0,-1,-1,-1}};
-                       int tonari_x[4][8] = {{-1,0,1,-1,1,-1,0,1},
-                                             {1,0,-1,1,-1,1,0,-1},
-                                             {-1,0,1,-1,1,-1,0,1},
-                                             {1,0,-1,1,-1,1,0,-1}};
-
-                       if (m_ptr->fy < py && m_ptr->fx < px) tonari = 0;
-                       else if (m_ptr->fy < py) tonari = 1;
-                       else if (m_ptr->fx < px) tonari = 2;
-                       else tonari = 3;
-
-                       for (i = 0; i < 8; i++)
-                       {
-                               int next_x = x + tonari_x[tonari][i];
-                               int next_y = y + tonari_y[tonari][i];
-                               cave_type *c_ptr;
-
-                               /* Access the next grid */
-                               c_ptr = &cave[next_y][next_x];
-
-                               /* Skip door, rubble, wall, tree, mountain, etc. */
-                               if (!cave_have_flag_grid(c_ptr, FF_PROJECT)) continue;
-
-                               if (projectable(m_ptr->fy, m_ptr->fx, next_y, next_x))
-                               {
-                                       y = next_y;
-                                       x = next_x;
-                                       success = TRUE;
-                                       break;
-                               }
-                       }
-               }
+               if (!success) success = adjacent_grid_check(m_ptr, &y, &x, FF_PROJECT, projectable);
 
                if (!success)
                {
@@ -1420,6 +1453,18 @@ bool make_attack_spell(int m_idx)
                                f6 &= (RF6_INDIRECT_MASK);
                                success = TRUE;
                        }
+
+                       if (y_br_lite && x_br_lite && (m_ptr->cdis < MAX_RANGE/2) && one_in_(5))
+                       {
+                               if (!success)
+                               {
+                                       y = y_br_lite;
+                                       x = x_br_lite;
+                                       do_spell = DO_SPELL_BR_LITE;
+                                       success = TRUE;
+                               }
+                               else f4 |= (RF4_BR_LITE);
+                       }
                }
 
                /* No spells */
@@ -1674,82 +1719,7 @@ msg_format("%^s
                        if (blind) msg_format("%^s mumbles powerfully.", m_name);
                        else msg_format("%^s invokes a dispel magic.", m_name);
 #endif
-                       set_fast(0, TRUE);
-                       set_lightspeed(0, TRUE);
-                       set_slow(0, TRUE);
-                       set_shield(0, TRUE);
-                       set_blessed(0, TRUE);
-                       set_tsuyoshi(0, TRUE);
-                       set_hero(0, TRUE);
-                       set_shero(0, TRUE);
-                       set_protevil(0, TRUE);
-                       set_invuln(0, TRUE);
-                       set_wraith_form(0, TRUE);
-                       set_kabenuke(0, TRUE);
-                       set_tim_res_nether(0, TRUE);
-                       set_tim_res_time(0, TRUE);
-                       /* by henkma */
-                       set_tim_reflect(0,TRUE);
-                       set_multishadow(0,TRUE);
-                       set_dustrobe(0,TRUE);
-
-                       set_tim_invis(0, TRUE);
-                       set_tim_infra(0, TRUE);
-                       set_tim_esp(0, TRUE);
-                       set_tim_regen(0, TRUE);
-                       set_tim_stealth(0, TRUE);
-                       set_tim_levitation(0, TRUE);
-                       set_tim_sh_touki(0, TRUE);
-                       set_tim_sh_fire(0, TRUE);
-                       set_tim_sh_holy(0, TRUE);
-                       set_tim_eyeeye(0, TRUE);
-                       set_magicdef(0, TRUE);
-                       set_resist_magic(0, TRUE);
-                       set_oppose_acid(0, TRUE);
-                       set_oppose_elec(0, TRUE);
-                       set_oppose_fire(0, TRUE);
-                       set_oppose_cold(0, TRUE);
-                       set_oppose_pois(0, TRUE);
-                       set_ultimate_res(0, TRUE);
-                       set_mimic(0, 0, TRUE);
-                       set_ele_attack(0, 0);
-                       set_ele_immune(0, 0);
-                       /* Cancel glowing hands */
-                       if (p_ptr->special_attack & ATTACK_CONFUSE)
-                       {
-                               p_ptr->special_attack &= ~(ATTACK_CONFUSE);
-#ifdef JP
-                               msg_print("¼ê¤Îµ±¤­¤¬¤Ê¤¯¤Ê¤Ã¤¿¡£");
-#else
-                               msg_print("Your hands stop glowing.");
-#endif
-
-                       }
-                       if ((p_ptr->pclass == CLASS_BARD) && (p_ptr->magic_num1[0]))
-                       {
-                               p_ptr->magic_num1[1] = p_ptr->magic_num1[0];
-                               p_ptr->magic_num1[0] = 0;
-#ifdef JP
-                               msg_print("²Î¤¬ÅÓÀڤ줿¡£");
-#else
-                               msg_print("Your singing is interrupted.");
-#endif
-                               p_ptr->action = ACTION_NONE;
-
-                               /* Recalculate bonuses */
-                               p_ptr->update |= (PU_BONUS | PU_HP);
-
-                               /* Redraw map */
-                               p_ptr->redraw |= (PR_MAP | PR_STATUS | PR_STATE);
-
-                               /* Update monsters */
-                               p_ptr->update |= (PU_MONSTERS);
-
-                               /* Window stuff */
-                               p_ptr->window |= (PW_OVERHEAD | PW_DUNGEON);
-
-                               p_ptr->energy_need += ENERGY_NEED();
-                       }
+                       dispel_player();
                        if (p_ptr->riding) dispel_monster_status(p_ptr->riding);
 
 #ifdef JP
@@ -1977,7 +1947,7 @@ else msg_format("%^s
 #endif
 
                        dam = ((m_ptr->hp / 6) > 400 ? 400 : (m_ptr->hp / 6));
-                       breath(y, x, m_idx, GF_LITE, dam,0, TRUE, MS_BR_LITE, learnable);
+                       breath(y_br_lite, x_br_lite, m_idx, GF_LITE, dam,0, TRUE, MS_BR_LITE, learnable);
                        update_smart_learn(m_idx, DRS_LITE);
                        break;
                }
@@ -3400,7 +3370,7 @@ msg_format("%^s
                        msg_format("%^s blinks away.", m_name);
 #endif
 
-                       teleport_away(m_idx, 10, FALSE, FALSE);
+                       teleport_away(m_idx, 10, 0L);
                        p_ptr->update |= (PU_MONSTERS);
                        break;
                }
@@ -3539,7 +3509,7 @@ msg_format("%^s
 #else
                                                msg_format("%^s suddenly go out of your sight!", m_name);
 #endif
-                                               teleport_away(m_idx, 10, FALSE, FALSE);
+                                               teleport_away(m_idx, 10, TELEPORT_NONMAGICAL);
                                                p_ptr->update |= (PU_MONSTERS);
                                        }
                                        else
@@ -3548,12 +3518,12 @@ msg_format("%^s
                                                bool fear; /* dummy */
 
 #ifdef JP
-                                               msg_format("%^s¤¬¤¢¤Ê¤¿¤òÄϤó¤Ç¶õÃ椫¤éÅꤲÍ¤¿¡£", m_name);
+                                               msg_format("%^s¤¬¤¢¤Ê¤¿¤òÄϤó¤Ç¶õÃ椫¤éÅꤲÍî¤Ȥ·¤¿¡£", m_name);
 #else
                                                msg_format("%^s holds you, and drops from the sky.", m_name);
 #endif
                                                dam = damroll(4, 8);
-                                               teleport_player_to(m_ptr->fy, m_ptr->fx, FALSE, TRUE);
+                                               teleport_player_to(m_ptr->fy, m_ptr->fx, TELEPORT_NONMAGICAL | TELEPORT_PASSIVE);
 
                                                sound(SOUND_FALL);
 
@@ -3617,7 +3587,7 @@ msg_format("%^s
                        msg_format("%^s commands you to return.", m_name);
 #endif
 
-                       teleport_player_to(m_ptr->fy, m_ptr->fx, TRUE, TRUE);
+                       teleport_player_to(m_ptr->fy, m_ptr->fx, TELEPORT_PASSIVE);
                        learn_spell(MS_TELE_TO);
                        break;
                }
@@ -4430,6 +4400,9 @@ msg_print("
                /* RF6_S_UNIQUE */
                case 160+31:
                {
+                       bool uniques_are_summoned = FALSE;
+                       int non_unique_type = SUMMON_HI_UNDEAD;
+
                        disturb(1, 0);
 #ifdef JP
 if (blind) msg_format("%^s¤¬²¿¤«¤ò¤Ä¤Ö¤ä¤¤¤¿¡£", m_name);
@@ -4447,28 +4420,26 @@ else msg_format("%^s
                        {
                                count += summon_specific(m_idx, y, x, rlev, SUMMON_UNIQUE, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE));
                        }
-                       if (r_ptr->flags3 & RF3_GOOD)
-                       {
-                               for (k = count; k < s_num_4; k++)
-                               {
-                                       count += summon_specific(m_idx, y, x, rlev, SUMMON_ANGEL, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE));
-                               }
-                       }
-                       else
+
+                       if (count) uniques_are_summoned = TRUE;
+
+                       if ((m_ptr->sub_align & (SUB_ALIGN_GOOD | SUB_ALIGN_EVIL)) == (SUB_ALIGN_GOOD | SUB_ALIGN_EVIL))
+                               non_unique_type = 0;
+                       else if (m_ptr->sub_align & SUB_ALIGN_GOOD)
+                               non_unique_type = SUMMON_ANGEL;
+
+                       for (k = count; k < s_num_4; k++)
                        {
-                               for (k = count; k < s_num_4; k++)
-                               {
-                                       count += summon_specific(m_idx, y, x, rlev, SUMMON_HI_UNDEAD, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE));
-                               }
+                               count += summon_specific(m_idx, y, x, rlev, non_unique_type, (PM_ALLOW_GROUP | PM_ALLOW_UNIQUE));
                        }
+
                        if (blind && count)
                        {
 #ifdef JP
-msg_print("¿¤¯¤ÎÎ϶¯¤¤¤â¤Î¤¬´Ö¶á¤Ë¸½¤ì¤¿²»¤¬Ê¹¤³¤¨¤ë¡£");
+                               msg_format("¿¤¯¤Î%s¤¬´Ö¶á¤Ë¸½¤ì¤¿²»¤¬Ê¹¤³¤¨¤ë¡£", uniques_are_summoned ? "Î϶¯¤¤¤â¤Î" : "¤â¤Î");
 #else
-                               msg_print("You hear many powerful things appear nearby.");
+                               msg_format("You hear many %s appear nearby.", uniques_are_summoned ? "powerful things" : "things");
 #endif
-
                        }
                        break;
                }
@@ -4498,7 +4469,7 @@ msg_print("¿
                        p_ptr->mane_num++;
                        new_mane = TRUE;
 
-                       p_ptr->redraw |= (PR_MANE);
+                       p_ptr->redraw |= (PR_IMITATION);
                }
        }