explode() while engulfed (trunk only)

For an explosion caused by the player while the hero is engulfed,
skip adjacent monsters.  Also, don't give "you hear a blast" when an
unseen explosion is caused by a scroll of fire (explosion is always unseen
when hero is engulfed, regardless of explosion's cause).  [Offhand I'm
not sure whether something other than the player can trigger an explosion
while the hero is engulfed.]  Lastly, round up instead of down when a
monster takes half damage, so that non-zero can't be reduced to zero.
This commit is contained in:
nethack.rankin
2007-04-30 04:56:37 +00:00
parent 3c5b8398bd
commit 6aff1bfad1
2 changed files with 14 additions and 6 deletions
+1
View File
@@ -223,6 +223,7 @@ rogue's backstab bonus doesn't apply for throwing attacks
hiding monsters who are unhidden when hero leaves a level can hide upon return hiding monsters who are unhidden when hero leaves a level can hide upon return
touching a pile of objects while blind affects hero even when the pile is touching a pile of objects while blind affects hero even when the pile is
big enough to give "there are many objects here" and not list them big enough to give "there are many objects here" and not list them
explosion while engulfed only affects engulfer and hero, not adjacent monsters
Platform- and/or Interface-Specific Fixes Platform- and/or Interface-Specific Fixes
+13 -6
View File
@@ -45,7 +45,7 @@ int expltype;
int explmask[3][3]; int explmask[3][3];
/* 0=normal explosion, 1=do shieldeff, 2=do nothing */ /* 0=normal explosion, 1=do shieldeff, 2=do nothing */
boolean shopdamage = FALSE, generic = FALSE, physical_dmg = FALSE, boolean shopdamage = FALSE, generic = FALSE, physical_dmg = FALSE,
do_hallu = FALSE; do_hallu = FALSE, inside_engulfer;
char hallu_buf[BUFSZ]; char hallu_buf[BUFSZ];
short exploding_wand_typ = 0; short exploding_wand_typ = 0;
@@ -72,6 +72,9 @@ int expltype;
mdef = m_at(x, y); mdef = m_at(x, y);
expltype = -expltype; expltype = -expltype;
} }
/* if hero is engulfed and caused the explosion, only hero and
engulfer will be affected */
inside_engulfer = (u.uswallow && type >= 0);
if (olet == MON_EXPLODE) { if (olet == MON_EXPLODE) {
str = killer.name; str = killer.name;
@@ -243,7 +246,7 @@ int expltype;
str = "explosion"; str = "explosion";
generic = TRUE; generic = TRUE;
} }
if (!Deaf) You_hear("a blast."); if (!Deaf && olet != SCROLL_CLASS) You_hear("a blast.");
} }
if (dam) if (dam)
@@ -251,10 +254,12 @@ int expltype;
if (explmask[i][j] == 2) continue; if (explmask[i][j] == 2) continue;
if (i+x-1 == u.ux && j+y-1 == u.uy) if (i+x-1 == u.ux && j+y-1 == u.uy)
uhurt = (explmask[i][j] == 1) ? 1 : 2; uhurt = (explmask[i][j] == 1) ? 1 : 2;
/* for inside_engulfer, only <u.ux,u.uy> is affected */
else if (inside_engulfer) continue;
idamres = idamnonres = 0; idamres = idamnonres = 0;
if (type >= 0) if (type >= 0 && !u.uswallow)
(void)zap_over_floor((xchar)(i+x-1), (xchar)(j+y-1), (void)zap_over_floor((xchar)(i+x-1), (xchar)(j+y-1),
type, &shopdamage, exploding_wand_typ); type, &shopdamage, exploding_wand_typ);
mtmp = m_at(i+x-1, j+y-1); mtmp = m_at(i+x-1, j+y-1);
#ifdef STEED #ifdef STEED
@@ -318,9 +323,10 @@ int expltype;
int mdam = dam; int mdam = dam;
if (resist(mtmp, olet, 0, FALSE)) { if (resist(mtmp, olet, 0, FALSE)) {
if (cansee(i+x-1,j+y-1)) /* inside_engulfer: <i+x-1,j+y-1> == <u.ux,u.uy> */
if (cansee(i+x-1,j+y-1) || inside_engulfer)
pline("%s resists the %s!", Monnam(mtmp), str); pline("%s resists the %s!", Monnam(mtmp), str);
mdam = dam/2; mdam = (dam + 1) / 2;
} }
if (mtmp == u.ustuck) if (mtmp == u.ustuck)
mdam *= 2; mdam *= 2;
@@ -420,6 +426,7 @@ int expltype;
/* explosions are noisy */ /* explosions are noisy */
i = dam * dam; i = dam * dam;
if (i < 50) i = 50; /* in case random damage is very small */ if (i < 50) i = 50; /* in case random damage is very small */
if (inside_engulfer) i = (i + 3) / 4;
wake_nearto(x, y, i); wake_nearto(x, y, i);
} }