]> granicus.if.org Git - nethack/commitdiff
Unify enlightenment self-knowledgeable effect
authorPasi Kallinen <paxed@alt.org>
Fri, 27 Nov 2020 17:59:16 +0000 (19:59 +0200)
committerPasi Kallinen <paxed@alt.org>
Fri, 27 Nov 2020 17:59:16 +0000 (19:59 +0200)
include/extern.h
src/potion.c
src/zap.c

index 0147a619d6c4cede48a762080c2d1af233c00419..946550810c2ae5f022f9fc184fbfdd2a277f29ef 100644 (file)
@@ -3165,6 +3165,7 @@ E int FDECL(bhito, (struct obj *, struct obj *));
 E int FDECL(bhitpile,
             (struct obj *, int (*)(OBJ_P, OBJ_P), int, int, SCHAR_P));
 E int FDECL(zappable, (struct obj *));
+E void NDECL(do_enlightenment_effect);
 E void FDECL(zapnodir, (struct obj *));
 E int NDECL(dozap);
 E int FDECL(zapyourself, (struct obj *, BOOLEAN_P));
index 34ff6de8e9cf6d78b5920faede89ecbd52f7d2b0..bf2f2becd2cf4a934516629c8229366dbe58d3c1 100644 (file)
@@ -725,11 +725,7 @@ register struct obj *otmp;
                 (void) adjattrib(A_INT, 1, FALSE);
                 (void) adjattrib(A_WIS, 1, FALSE);
             }
-            You_feel("self-knowledgeable...");
-            display_nhwindow(WIN_MESSAGE, FALSE);
-            enlightenment(MAGICENLIGHTENMENT, ENL_GAMEINPROGRESS);
-            pline_The("feeling subsides.");
-            exercise(A_WIS, TRUE);
+            do_enlightenment_effect();
         }
         break;
     case SPE_INVISIBILITY:
index edb4943d2a2af0d7b2f887fcaac55783a10585b9..0b4f7f4bd5a690fe79cb8dd9a6d931a20b01fb2d 100644 (file)
--- a/src/zap.c
+++ b/src/zap.c
@@ -2227,6 +2227,16 @@ register struct obj *wand;
     return 1;
 }
 
+void
+do_enlightenment_effect()
+{
+    You_feel("self-knowledgeable...");
+    display_nhwindow(WIN_MESSAGE, FALSE);
+    enlightenment(MAGICENLIGHTENMENT, ENL_GAMEINPROGRESS);
+    pline_The("feeling subsides.");
+    exercise(A_WIS, TRUE);
+}
+
 /*
  * zapnodir - zaps a NODIR wand/spell.
  * added by GAN 11/03/86
@@ -2267,11 +2277,7 @@ register struct obj *obj;
         break;
     case WAN_ENLIGHTENMENT:
         known = TRUE;
-        You_feel("self-knowledgeable...");
-        display_nhwindow(WIN_MESSAGE, FALSE);
-        enlightenment(MAGICENLIGHTENMENT, ENL_GAMEINPROGRESS);
-        pline_The("feeling subsides.");
-        exercise(A_WIS, TRUE);
+        do_enlightenment_effect();
         break;
     }
     if (known) {