]> granicus.if.org Git - nethack/commitdiff
fire attack messages
authornethack.rankin <nethack.rankin>
Tue, 10 Dec 2002 10:21:28 +0000 (10:21 +0000)
committernethack.rankin <nethack.rankin>
Tue, 10 Dec 2002 10:21:28 +0000 (10:21 +0000)
     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
src/mhitm.c
src/mhitu.c
src/mondata.c
src/uhitm.c

index 58db92c4f6fba1577c36611a9925254576c842d9..f1558d659e63e784a363e5cf9c760f985a91a997 100644 (file)
@@ -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 ### */
 
index 057805e55277896f6d5be623fcbf6be9c9372f5c..8cae9ed84681208703b41266a0a1499bcf54ebaf 100644 (file)
@@ -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));
index a7625d039ddcffea1c86ddced52ae6d3962d0cbc..4891148358f546f83911cf71870ecbada0f39a30 100644 (file)
@@ -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!");
index f9b2a5e29255c55dd4c4dfceefa0111091d4b4e5..81dbe913e6cd420473745746ce2d87a609eabb5d 100644 (file)
@@ -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*/
index 6f77100334f26ea158ad9668db03ab26b316f826..a152e929551e6a6487535bf81e1889f39d41aa38 100644 (file)
@@ -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)