From 89c4c3a72222da201cd35c4da4fa9bc213868331 Mon Sep 17 00:00:00 2001 From: Pasi Kallinen Date: Fri, 6 Dec 2024 21:26:47 +0200 Subject: [PATCH] Tourists gain experience by seeing new types of creatures up close Experience equivalent to killing a monster is gained when starting a turn adjacent to and being able to see the monster. Breaks saves. Idea and parts of code via dNetHack --- doc/fixes3-7-0.txt | 1 + include/hack.h | 1 + include/patchlevel.h | 2 +- src/allmain.c | 24 ++++++++++++++++++++++++ 4 files changed, 27 insertions(+), 1 deletion(-) diff --git a/doc/fixes3-7-0.txt b/doc/fixes3-7-0.txt index 77ed9ba7a..c68890634 100644 --- a/doc/fixes3-7-0.txt +++ b/doc/fixes3-7-0.txt @@ -2730,6 +2730,7 @@ enlightenment/attribute disclosure for saving-grace: include a line for have "X " for explore mode, or "D " for debug mode if any of the games shown in its menu weren't saved during normal play; if they're all normal play, the prefix is suppressed +tourists gain experience by seeing new types of creatures up close Platform- and/or Interface-Specific New Features diff --git a/include/hack.h b/include/hack.h index 0851da3ef..40b4d4ada 100644 --- a/include/hack.h +++ b/include/hack.h @@ -673,6 +673,7 @@ struct mvitals { uchar born; uchar died; uchar mvflags; + Bitfield(seen_close, 1); }; diff --git a/include/patchlevel.h b/include/patchlevel.h index 3f1d88e81..41708bc86 100644 --- a/include/patchlevel.h +++ b/include/patchlevel.h @@ -17,7 +17,7 @@ * Incrementing EDITLEVEL can be used to force invalidation of old bones * and save files. */ -#define EDITLEVEL 110 +#define EDITLEVEL 111 /* * Development status possibilities. diff --git a/src/allmain.c b/src/allmain.c index 253ac82a4..b8de1f7a5 100644 --- a/src/allmain.c +++ b/src/allmain.c @@ -14,6 +14,7 @@ staticfn void moveloop_preamble(boolean); staticfn void u_calc_moveamt(int); +staticfn void see_nearby_monsters(void); staticfn void maybe_do_tutorial(void); #ifdef POSITIONBAR staticfn void do_positionbar(void); @@ -154,6 +155,28 @@ u_calc_moveamt(int wtcap) u.umovement = 0; } +/* mark a monster type as seen when we see it next to us */ +staticfn void +see_nearby_monsters(void) +{ + coordxy x, y; + + if (Blind || !Role_if(PM_TOURIST)) + return; + + for (x = u.ux - 1; x <= u.ux + 1; x++) + for (y = u.uy - 1; y <= u.uy + 1; y++) + if (isok(x, y) && MON_AT(x, y)) { + struct monst *mtmp = m_at(x, y); + + if (canseemon(mtmp) && !svm.mvitals[monsndx(mtmp->data)].seen_close) { + svm.mvitals[monsndx(mtmp->data)].seen_close = TRUE; + more_experienced(experience(mtmp, 0), 0); + newexplevel(); + } + } +} + #if defined(MICRO) || defined(WIN32) static int mvl_abort_lev; #endif @@ -410,6 +433,7 @@ moveloop_core(void) else if (u.uburied) under_ground(0); + see_nearby_monsters(); } /* actual time passed */ /****************************************/