From 75c457666867c9f34df826386816fd0c1a15927f Mon Sep 17 00:00:00 2001 From: "nethack.rankin" Date: Sun, 13 Nov 2005 03:20:20 +0000 Subject: [PATCH] gas spore explosions while hallucinating (trunk only) From a bug report: when hallucinating, messages for affected monsters and/or hero referred to "the gas spore's explosion" instead of supplying random monster names. This is a little bit tricky; since it can be displayed multiple times for one explosion, it needs to be constructed on the fly in explode(). (Caller couldn't have handled this anyway since it's using the value for killed-by reason which mustn't be distorted by hallucination.) --- doc/fixes35.0 | 1 + src/explode.c | 34 +++++++++++++++++++++++++++------- 2 files changed, 28 insertions(+), 7 deletions(-) diff --git a/doc/fixes35.0 b/doc/fixes35.0 index 9212446bc..77fb26943 100644 --- a/doc/fixes35.0 +++ b/doc/fixes35.0 @@ -97,6 +97,7 @@ avoid false matches when looking up fruit names ("grapefruit" isn't "grape") handle pluralization of man-at-arms and singularization of men-at-arms assigning an artifact name is rejected on objects with similar description to corresponding artifact's type rather than just those of the same type +adjust feedback for gas spore explosion when hallucinating Platform- and/or Interface-Specific Fixes diff --git a/src/explode.c b/src/explode.c index 9625d193e..5ca0fe3dc 100644 --- a/src/explode.c +++ b/src/explode.c @@ -1,4 +1,4 @@ -/* SCCS Id: @(#)explode.c 3.5 2004/12/21 */ +/* SCCS Id: @(#)explode.c 3.5 2005/11/12 */ /* Copyright (C) 1990 by Ken Arromdee */ /* NetHack may be freely redistributed. See license for details. */ @@ -44,9 +44,9 @@ int expltype; uchar adtyp; int explmask[3][3]; /* 0=normal explosion, 1=do shieldeff, 2=do nothing */ - boolean shopdamage = FALSE; - boolean generic = FALSE; - boolean physical_dmg = FALSE; + boolean shopdamage = FALSE, generic = FALSE, physical_dmg = FALSE, + do_hallu = FALSE; + char hallu_buf[BUFSZ]; if (olet == WAND_CLASS) /* retributive strike */ switch (Role_switch) { @@ -62,6 +62,7 @@ int expltype; if (olet == MON_EXPLODE) { str = killer.name; + do_hallu = Hallucination && strstri(str, "'s explosion"); adtyp = AD_PHYS; } else switch (abs(type) % 10) { @@ -248,6 +249,17 @@ int expltype; mtmp = u.usteed; #endif if (!mtmp) continue; + if (do_hallu) { + /* replace "gas spore" with a different description + for each target (we can't distinguish personal names + like "Barney" here in order to suppress "the" below, + so avoid any which begins with a capital letter) */ + do { + Sprintf(hallu_buf, "%s explosion", + s_suffix(rndmonnam())); + } while (*hallu_buf != lowc(*hallu_buf)); + str = hallu_buf; + } if (u.uswallow && mtmp == u.ustuck) { if (is_animal(u.ustuck->data)) pline("%s gets %s!", @@ -316,8 +328,16 @@ int expltype; /* Do your injury last */ if (uhurt) { if ((type >= 0 || adtyp == AD_PHYS) && /* gas spores */ - flags.verbose && olet != SCROLL_CLASS) - You("are caught in the %s!", str); + flags.verbose && olet != SCROLL_CLASS) { + if (do_hallu) { /* (see explanation above) */ + do { + Sprintf(hallu_buf, "%s explosion", + s_suffix(rndmonnam())); + } while (*hallu_buf != lowc(*hallu_buf)); + str = hallu_buf; + } + You("are caught in the %s!", str); + } /* do property damage first, in case we end up leaving bones */ if (adtyp == AD_FIRE) burn_away_slime(); if (Invulnerable) { @@ -349,7 +369,7 @@ int expltype; /* killer handled by caller */ if (generic) killer.name[0] = 0; - else if (str != killer.name) + else if (str != killer.name && str != hallu_buf) Strcpy(killer.name, str); killer.format = KILLED_BY_AN; } else if (type >= 0 && olet != SCROLL_CLASS) { -- 2.40.0