From 6aff1bfad1b81dd515947ed503286d67fe1255a7 Mon Sep 17 00:00:00 2001 From: "nethack.rankin" Date: Mon, 30 Apr 2007 04:56:37 +0000 Subject: [PATCH] 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. --- doc/fixes35.0 | 1 + src/explode.c | 19 +++++++++++++------ 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/doc/fixes35.0 b/doc/fixes35.0 index 0e2a1b5ff..47de1fbfd 100644 --- a/doc/fixes35.0 +++ b/doc/fixes35.0 @@ -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 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 +explosion while engulfed only affects engulfer and hero, not adjacent monsters Platform- and/or Interface-Specific Fixes diff --git a/src/explode.c b/src/explode.c index bac28bfbb..e409cbebd 100644 --- a/src/explode.c +++ b/src/explode.c @@ -45,7 +45,7 @@ int expltype; int explmask[3][3]; /* 0=normal explosion, 1=do shieldeff, 2=do nothing */ boolean shopdamage = FALSE, generic = FALSE, physical_dmg = FALSE, - do_hallu = FALSE; + do_hallu = FALSE, inside_engulfer; char hallu_buf[BUFSZ]; short exploding_wand_typ = 0; @@ -72,6 +72,9 @@ int expltype; mdef = m_at(x, y); 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) { str = killer.name; @@ -243,7 +246,7 @@ int expltype; str = "explosion"; generic = TRUE; } - if (!Deaf) You_hear("a blast."); + if (!Deaf && olet != SCROLL_CLASS) You_hear("a blast."); } if (dam) @@ -251,10 +254,12 @@ int expltype; if (explmask[i][j] == 2) continue; if (i+x-1 == u.ux && j+y-1 == u.uy) uhurt = (explmask[i][j] == 1) ? 1 : 2; + /* for inside_engulfer, only is affected */ + else if (inside_engulfer) continue; idamres = idamnonres = 0; - if (type >= 0) + if (type >= 0 && !u.uswallow) (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); #ifdef STEED @@ -318,9 +323,10 @@ int expltype; int mdam = dam; if (resist(mtmp, olet, 0, FALSE)) { - if (cansee(i+x-1,j+y-1)) + /* inside_engulfer: == */ + if (cansee(i+x-1,j+y-1) || inside_engulfer) pline("%s resists the %s!", Monnam(mtmp), str); - mdam = dam/2; + mdam = (dam + 1) / 2; } if (mtmp == u.ustuck) mdam *= 2; @@ -420,6 +426,7 @@ int expltype; /* explosions are noisy */ i = dam * dam; if (i < 50) i = 50; /* in case random damage is very small */ + if (inside_engulfer) i = (i + 3) / 4; wake_nearto(x, y, i); }