From b2a8ed5f99a508cdf87c831430e256d9a77d5b77 Mon Sep 17 00:00:00 2001 From: nothere Date: Tue, 2 Dec 2003 17:43:20 +0000 Subject: [PATCH] =?utf8?q?=E9=96=83=E5=85=89=E3=81=A8=E5=BC=B1=E3=81=84?= =?utf8?q?=E9=96=83=E5=85=89=E3=81=AE=E3=83=96=E3=83=AC=E3=82=B9=E3=81=A8?= =?utf8?q?=E3=83=93=E3=83=BC=E3=83=A0=E3=81=AF=E9=80=8F=E6=98=8E=E3=81=AA?= =?utf8?q?=E5=A3=81=E3=82=92=E9=80=9A=E3=81=99=E3=82=88=E3=81=86=E3=81=AB?= =?utf8?q?=E5=A4=89=E6=9B=B4.=20=E3=83=9C=E3=83=AB=E3=83=88=E3=81=A8=20?= =?utf8?q?=E3=83=9C=E3=83=BC=E3=83=AB=E3=81=AF=E9=80=9A=E3=81=95=E3=81=AA?= =?utf8?q?=E3=81=84.=20=E9=96=83=E5=85=89=E3=81=AE=E3=83=96=E3=83=AC?= =?utf8?q?=E3=82=B9=E3=82=92=E3=83=97=E3=83=AC=E3=82=A4=E3=83=A4=E3=83=BC?= =?utf8?q?=E3=81=AB=E4=BD=BF=E3=81=86=E9=9A=9B=E3=81=AE=E7=89=B9=E6=AE=8A?= =?utf8?q?=E5=88=A4=E5=AE=9A=E8=BF=BD=E5=8A=A0.=20=E3=81=BE=20=E3=81=9F,?= =?utf8?q?=20=E5=A3=81=E3=81=AE=E4=B8=AD=E3=81=AB=E3=81=84=E3=82=8B?= =?utf8?q?=E3=83=97=E3=83=AC=E3=82=A4=E3=83=A4=E3=83=BC=E3=81=AB=E5=88=86?= =?utf8?q?=E8=A7=A3=E3=81=AE=E3=83=96=E3=83=AC=E3=82=B9=E3=82=92=E5=90=90?= =?utf8?q?=E3=81=8F=E5=9C=B0=E5=BD=A2=E5=88=A4=E5=AE=9A=E3=82=92!PROJECT?= =?utf8?q?=20&&=20HURT=5FDISI=E3=81=A8=E3=81=97=E3=81=9F.=20=E3=81=93?= =?utf8?q?=E3=82=8C=E3=81=AF=E5=88=86=E8=A7=A3=E3=81=A7=E3=81=8D=E3=81=9A?= =?utf8?q?=E3=81=AB=E6=8A=9C=E3=81=91=E3=82=89=E3=82=8C=E3=82=8B=E5=A3=81?= =?utf8?q?=E3=81=8C=E3=81=82=E3=82=8B=E5=A0=B4=E5=90=88=E3=81=AF=E5=A8=81?= =?utf8?q?=E5=8A=9B=E3=81=8C=E5=8D=8A=E6=B8=9B=20=E3=81=99=E3=82=8B?= =?utf8?q?=E3=81=9F=E3=82=81.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- src/defines.h | 1 + src/externs.h | 2 +- src/mspells1.c | 38 +++++++++++++++++++++++++++++++------ src/mspells2.c | 31 +++++++++++++++++++++++++----- src/spells1.c | 60 +++++++++++++++++++++++++++++++++++++++++++++------------- 5 files changed, 107 insertions(+), 25 deletions(-) diff --git a/src/defines.h b/src/defines.h index 315c8d105..5d1251b9c 100644 --- a/src/defines.h +++ b/src/defines.h @@ -2682,6 +2682,7 @@ #define PROJECT_NO_HANGEKI 0x1000 #define PROJECT_PATH 0x2000 #define PROJECT_FAST 0x4000 +#define PROJECT_LOS 0x8000 /* * Bit flags for the "enchant()" function diff --git a/src/externs.h b/src/externs.h index 3176e5bcd..56735a545 100644 --- a/src/externs.h +++ b/src/externs.h @@ -1006,7 +1006,7 @@ extern bool save_floor(saved_floor_type *sf_ptr, u32b mode); /* spells1.c */ extern bool in_disintegration_range(int y1, int x1, int y2, int x2); -extern void breath_shape(u16b *path_g, int dist, int *pgrids, byte *gx, byte *gy, byte *gm, int *pgm_rad, int rad, int y1, int x1, int y2, int x2, bool disint_ball); +extern void breath_shape(u16b *path_g, int dist, int *pgrids, byte *gx, byte *gy, byte *gm, int *pgm_rad, int rad, int y1, int x1, int y2, int x2, int typ); extern int take_hit(int damage_type, int damage, cptr kb_str, int monspell); extern u16b bolt_pict(int y, int x, int ny, int nx, int typ); extern sint project_path(u16b *gp, int range, int y1, int x1, int y2, int x2, int flg); diff --git a/src/mspells1.c b/src/mspells1.c index e8f9e25a4..2b196cab4 100644 --- a/src/mspells1.c +++ b/src/mspells1.c @@ -1258,7 +1258,8 @@ bool make_attack_spell(int m_idx) char m_poss[80]; #endif bool no_inate = FALSE; - bool do_disi = FALSE; + bool do_br_lite = FALSE; + bool do_br_disi = FALSE; int dam = 0; u32b mode = 0L; int s_num_6 = (easy_band ? 2 : 6); @@ -1317,8 +1318,14 @@ bool make_attack_spell(int m_idx) /* Check path */ if (projectable(m_ptr->fy, m_ptr->fx, y, x)) { - /* Breath disintegration to the glyph if possible */ - if (!have_flag(f_flags_bold(y, x), FF_PROJECT) && (f4 & RF4_BR_DISI) && one_in_(2)) do_disi = TRUE; + if (!have_flag(f_flags_bold(y, x), FF_PROJECT)) + { + /* Breath lite to the transparent wall if possible */ + if ((f4 & RF4_BR_LITE) && cave_los_bold(y, x) && one_in_(2)) do_br_lite = TRUE; + + /* Breath disintegration to the wall if possible */ + if ((f4 & RF4_BR_DISI) && have_flag(f_flags_bold(y, x), FF_HURT_DISI) && one_in_(2)) do_br_disi = TRUE; + } } /* Check path to next grid */ @@ -1331,7 +1338,15 @@ bool make_attack_spell(int m_idx) in_disintegration_range(m_ptr->fy, m_ptr->fx, y, x) && (one_in_(10) || (projectable(y, x, m_ptr->fy, m_ptr->fx) && one_in_(2)))) { - do_disi = TRUE; + do_br_disi = TRUE; + 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)))) + { + do_br_lite = TRUE; success = TRUE; } else @@ -1541,8 +1556,19 @@ bool make_attack_spell(int m_idx) monster_desc(m_poss, m_ptr, MD_PRON_VISIBLE | MD_POSSESSIVE); #endif - if (do_disi) - thrown_spell = 96+31; + if (do_br_lite && do_br_disi) + { + if (one_in_(2)) thrown_spell = 96+14; /* RF4_BR_LITE */ + else thrown_spell = 96+31; /* RF4_BR_DISI */ + } + else if (do_br_lite) + { + thrown_spell = 96+14; /* RF4_BR_LITE */ + } + else if (do_br_disi) + { + thrown_spell = 96+31; /* RF4_BR_DISI */ + } else { int attempt = 10; diff --git a/src/mspells2.c b/src/mspells2.c index c5dbe72ac..486f5aa0e 100644 --- a/src/mspells2.c +++ b/src/mspells2.c @@ -112,7 +112,7 @@ static bool direct_beam(int y1, int x1, int y2, int x2, monster_type *m_ptr) return TRUE; } -static bool breath_direct(int y1, int x1, int y2, int x2, int rad, bool disint_ball, bool friend) +static bool breath_direct(int y1, int x1, int y2, int x2, int rad, int typ, bool friend) { /* Must be the same as projectable() */ @@ -129,9 +129,25 @@ static bool breath_direct(int y1, int x1, int y2, int x2, int rad, bool disint_b bool hit2 = FALSE; bool hityou = FALSE; + int flg; + + switch (typ) + { + case GF_LITE: + case GF_LITE_WEAK: + flg = PROJECT_LOS; + break; + case GF_DISINTEGRATE: + flg = PROJECT_DISI; + break; + default: + flg = 0; + break; + } + /* Check the projection path */ - grid_n = project_path(grid_g, MAX_RANGE, y1, x1, y2, x2, disint_ball ? PROJECT_DISI : 0); - breath_shape(grid_g, grid_n, &grids, gx, gy, gm, &gm_rad, rad, y1, x1, y2, x2, disint_ball); + grid_n = project_path(grid_g, MAX_RANGE, y1, x1, y2, x2, flg); + breath_shape(grid_g, grid_n, &grids, gx, gy, gm, &gm_rad, rad, y1, x1, y2, x2, typ); for (i = 0; i < grids; i++) { @@ -451,14 +467,19 @@ bool monst_spell_monst(int m_idx) /* Expected breath radius */ int rad = (r_ptr->flags2 & RF2_POWERFUL) ? 3 : 2; - if (!breath_direct(m_ptr->fy, m_ptr->fx, t_ptr->fy, t_ptr->fx, rad, FALSE, TRUE)) + if (!breath_direct(m_ptr->fy, m_ptr->fx, t_ptr->fy, t_ptr->fx, rad, 0, TRUE)) { f4 &= ~(RF4_BREATH_MASK); f5 &= ~(RF5_BREATH_MASK); f6 &= ~(RF6_BREATH_MASK); } + else if ((f4 & RF4_BR_LITE) && + !breath_direct(m_ptr->fy, m_ptr->fx, t_ptr->fy, t_ptr->fx, rad, GF_LITE, TRUE)) + { + f4 &= ~(RF4_BR_LITE); + } else if ((f4 & RF4_BR_DISI) && - !breath_direct(m_ptr->fy, m_ptr->fx, t_ptr->fy, t_ptr->fx, rad, TRUE, TRUE)) + !breath_direct(m_ptr->fy, m_ptr->fx, t_ptr->fy, t_ptr->fx, rad, GF_DISINTEGRATE, TRUE)) { f4 &= ~(RF4_BR_DISI); } diff --git a/src/spells1.c b/src/spells1.c index 1771e41dd..a0a16f2ae 100644 --- a/src/spells1.c +++ b/src/spells1.c @@ -368,6 +368,10 @@ sint project_path(u16b *gp, int range, int y1, int x1, int y2, int x2, int flg) { if ((n > 0) && cave_stop_disintegration(y, x)) break; } + else if (flg & (PROJECT_LOS)) + { + if ((n > 0) && !cave_los_bold(y, x)) break; + } else if (!(flg & (PROJECT_PATH))) { /* Always stop at non-initial wall grids */ @@ -453,6 +457,10 @@ sint project_path(u16b *gp, int range, int y1, int x1, int y2, int x2, int flg) { if ((n > 0) && cave_stop_disintegration(y, x)) break; } + else if (flg & (PROJECT_LOS)) + { + if ((n > 0) && !cave_los_bold(y, x)) break; + } else if (!(flg & (PROJECT_PATH))) { /* Always stop at non-initial wall grids */ @@ -520,6 +528,10 @@ sint project_path(u16b *gp, int range, int y1, int x1, int y2, int x2, int flg) { if ((n > 0) && cave_stop_disintegration(y, x)) break; } + else if (flg & (PROJECT_LOS)) + { + if ((n > 0) && !cave_los_bold(y, x)) break; + } else if (!(flg & (PROJECT_PATH))) { /* Always stop at non-initial wall grids */ @@ -7977,7 +7989,7 @@ bool in_disintegration_range(int y1, int x1, int y2, int x2) /* * breath shape */ -void breath_shape(u16b *path_g, int dist, int *pgrids, byte *gx, byte *gy, byte *gm, int *pgm_rad, int rad, int y1, int x1, int y2, int x2, bool disint_ball) +void breath_shape(u16b *path_g, int dist, int *pgrids, byte *gx, byte *gy, byte *gm, int *pgm_rad, int rad, int y1, int x1, int y2, int x2, int typ) { int by = y1; int bx = x1; @@ -8025,16 +8037,21 @@ void breath_shape(u16b *path_g, int dist, int *pgrids, byte *gx, byte *gy, byte /* Enforce an arc */ if (distance(by, bx, y, x) != cdis) continue; - - if (disint_ball) + switch (typ) { + case GF_LITE: + case GF_LITE_WEAK: + /* Lights are stopped by opaque terrains */ + if (!los(by, bx, y, x)) continue; + break; + case GF_DISINTEGRATE: /* Disintegration are stopped only by perma-walls */ if (!in_disintegration_range(by, bx, y, x)) continue; - } - else - { - /* The blast is stopped by walls */ + break; + default: + /* Ball explosions are stopped by walls */ if (!projectable(by, bx, y, x)) continue; + break; } /* Save this grid */ @@ -8344,10 +8361,16 @@ bool project(int who, int rad, int y, int x, int dam, int typ, int flg, int mons grids++; } - if (typ == GF_DISINTEGRATE) + switch (typ) { + case GF_LITE: + case GF_LITE_WEAK: + if (breath || (flg & PROJECT_BEAM)) flg |= (PROJECT_LOS); + break; + case GF_DISINTEGRATE: flg |= (PROJECT_GRID); if (breath || (flg & PROJECT_BEAM)) flg |= (PROJECT_DISI); + break; } /* Calculate the projection path */ @@ -8635,6 +8658,11 @@ bool project(int who, int rad, int y, int x, int dam, int typ, int flg, int mons /* Hack -- Balls explode before reaching walls */ if (cave_stop_disintegration(ny, nx) && (rad > 0)) break; } + else if (flg & PROJECT_LOS) + { + /* Hack -- Balls explode before reaching walls */ + if (!cave_los_bold(ny, nx) && (rad > 0)) break; + } else { /* Hack -- Balls explode before reaching walls */ @@ -8751,7 +8779,7 @@ bool project(int who, int rad, int y, int x, int dam, int typ, int flg, int mons { flg &= ~(PROJECT_HIDE); - breath_shape(path_g, dist, &grids, gx, gy, gm, &gm_rad, rad, y1, x1, by, bx, (bool)(typ == GF_DISINTEGRATE)); + breath_shape(path_g, dist, &grids, gx, gy, gm, &gm_rad, rad, y1, x1, by, bx, typ); } else { @@ -8769,15 +8797,21 @@ bool project(int who, int rad, int y, int x, int dam, int typ, int flg, int mons /* Enforce a "circular" explosion */ if (distance(by, bx, y, x) != dist) continue; - if (typ == GF_DISINTEGRATE) + switch (typ) { + case GF_LITE: + case GF_LITE_WEAK: + /* Lights are stopped by opaque terrains */ + if (!los(by, bx, y, x)) continue; + break; + case GF_DISINTEGRATE: /* Disintegration are stopped only by perma-walls */ if (!in_disintegration_range(by, bx, y, x)) continue; - } - else - { + break; + default: /* Ball explosions are stopped by walls */ if (!projectable(by, bx, y, x)) continue; + break; } /* Save this grid */ -- 2.11.0