diff --git a/include/extern.h b/include/extern.h index 0147a619d..946550810 100644 --- a/include/extern.h +++ b/include/extern.h @@ -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)); diff --git a/src/potion.c b/src/potion.c index 34ff6de8e..bf2f2becd 100644 --- a/src/potion.c +++ b/src/potion.c @@ -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: diff --git a/src/zap.c b/src/zap.c index edb4943d2..0b4f7f4bd 100644 --- 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) {