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)