From b90f50075db38a4801ea12dce2836a4aec69abce Mon Sep 17 00:00:00 2001 From: "nethack.rankin" Date: Tue, 10 Dec 2002 10:21:28 +0000 Subject: [PATCH] fire attack messages Make sure the three instances of special fire effects stay synchronized in the future by moving the relevant code into its own routine. Shouldn't fire vortices and fire elementals also yield "already on fire"? How about ice vortices "melting"? --- include/extern.h | 1 + src/mhitm.c | 8 ++------ src/mhitu.c | 10 ++-------- src/mondata.c | 13 ++++++++++++- src/uhitm.c | 8 ++------ 5 files changed, 19 insertions(+), 21 deletions(-) diff --git a/include/extern.h b/include/extern.h index 58db92c4f..f1558d659 100644 --- a/include/extern.h +++ b/include/extern.h @@ -1164,6 +1164,7 @@ E int FDECL(little_to_big, (int)); E int FDECL(big_to_little, (int)); E const char *FDECL(locomotion, (const struct permonst *,const char *)); E const char *FDECL(stagger, (const struct permonst *,const char *)); +E const char *FDECL(on_fire, (struct permonst *,struct attack *)); /* ### monmove.c ### */ diff --git a/src/mhitm.c b/src/mhitm.c index 057805e55..8cae9ed84 100644 --- a/src/mhitm.c +++ b/src/mhitm.c @@ -1,4 +1,4 @@ -/* SCCS Id: @(#)mhitm.c 3.4 2002/11/07 */ +/* SCCS Id: @(#)mhitm.c 3.4 2002/12/09 */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* NetHack may be freely redistributed. See license for details. */ @@ -688,11 +688,7 @@ mdamagem(magr, mdef, mattk) } if (vis) pline("%s is %s!", Monnam(mdef), - mdef->data == &mons[PM_WATER_ELEMENTAL] ? "boiling" : - mdef->data == &mons[PM_FLAMING_SPHERE] ? - "already on fire" : - mattk->aatyp == AT_HUGS ? - "being roasted" : "on fire"); + on_fire(mdef->data, mattk)); if (pd == &mons[PM_STRAW_GOLEM] || pd == &mons[PM_PAPER_GOLEM]) { if (vis) pline("%s burns completely!", Monnam(mdef)); diff --git a/src/mhitu.c b/src/mhitu.c index a7625d039..489114835 100644 --- a/src/mhitu.c +++ b/src/mhitu.c @@ -1,4 +1,4 @@ -/* SCCS Id: @(#)mhitu.c 3.4 2002/10/17 */ +/* SCCS Id: @(#)mhitu.c 3.4 2002/12/09 */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* NetHack may be freely redistributed. See license for details. */ @@ -914,13 +914,7 @@ hitmu(mtmp, mattk) case AD_FIRE: hitmsg(mtmp, mattk); if (uncancelled) { - pline("You're %s!", - youmonst.data == &mons[PM_WATER_ELEMENTAL] ? - "boiling" : - youmonst.data == &mons[PM_FLAMING_SPHERE] ? - "already on fire" : - mattk->aatyp == AT_HUGS ? "being roasted" : - "on fire"); + pline("You're %s!", on_fire(youmonst.data, mattk)); if (youmonst.data == &mons[PM_STRAW_GOLEM] || youmonst.data == &mons[PM_PAPER_GOLEM]) { You("roast!"); diff --git a/src/mondata.c b/src/mondata.c index f9b2a5e29..81dbe913e 100644 --- a/src/mondata.c +++ b/src/mondata.c @@ -1,4 +1,4 @@ -/* SCCS Id: @(#)mondata.c 3.4 2002/04/06 */ +/* SCCS Id: @(#)mondata.c 3.4 2002/12/09 */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* NetHack may be freely redistributed. See license for details. */ @@ -664,6 +664,17 @@ const char *def; } +/* return a phrase describing the effect of fire attack on a type of monster */ +const char * +on_fire(mptr, mattk) +struct permonst *mptr; +struct attack *mattk; +{ + return (mptr == &mons[PM_WATER_ELEMENTAL]) ? "boiling" : + (mptr == &mons[PM_FLAMING_SPHERE]) ? "already on fire" : + (mattk->aatyp == AT_HUGS) ? "being roasted" : "on fire"; +} + #endif /* OVLB */ /*mondata.c*/ diff --git a/src/uhitm.c b/src/uhitm.c index 6f7710033..a152e9295 100644 --- a/src/uhitm.c +++ b/src/uhitm.c @@ -1,4 +1,4 @@ -/* SCCS Id: @(#)uhitm.c 3.4 2002/11/29 */ +/* SCCS Id: @(#)uhitm.c 3.4 2002/12/09 */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* NetHack may be freely redistributed. See license for details. */ @@ -1251,11 +1251,7 @@ register struct attack *mattk; case AD_FIRE: if (!Blind) pline("%s is %s!", Monnam(mdef), - mdef->data == &mons[PM_WATER_ELEMENTAL] ? "boiling" : - mdef->data == &mons[PM_FLAMING_SPHERE] ? - "already on fire" : - mattk->aatyp == AT_HUGS ? - "being roasted" : "on fire"); + on_fire(mdef->data, mattk)); if (pd == &mons[PM_STRAW_GOLEM] || pd == &mons[PM_PAPER_GOLEM]) { if (!Blind)