Tourists gain experience by using camera flash on monsters

This counts as seeing the monster up close, so the tourist
doesn't need to get next to the monster
This commit is contained in:
Pasi Kallinen
2024-12-07 11:18:13 +02:00
parent 12228cac49
commit 863d455e1d
4 changed files with 39 additions and 24 deletions

View File

@@ -1778,6 +1778,8 @@ extern void dealloc_mextra(struct monst *);
extern boolean usmellmon(struct permonst *);
extern void mimic_hit_msg(struct monst *, short);
extern void adj_erinys(unsigned);
extern void see_monster_closeup(struct monst *) NONNULLARG1;
extern void see_nearby_monsters(void);
/* ### mondata.c ### */

View File

@@ -14,7 +14,6 @@
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);
@@ -155,28 +154,6 @@ 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

View File

@@ -63,8 +63,11 @@ do_blinding_ray(struct obj *obj)
(int (*) (OBJ_P, OBJ_P)) 0, &obj);
obj->ox = u.ux, obj->oy = u.uy; /* flash_hits_mon() wants this */
if (mtmp)
if (mtmp) {
(void) flash_hits_mon(mtmp, obj);
if (obj->otyp == EXPENSIVE_CAMERA)
see_monster_closeup(mtmp);
}
/* normally bhit() would do this but for FLASHED_LIGHT we want it
to be deferred until after flash_hits_mon() */
transient_light_cleanup();

View File

@@ -5805,4 +5805,37 @@ adj_erinys(unsigned abuse)
pm->difficulty = min(10 + (u.ualign.abuse / 3), 25);
}
/* mark monster type as seen from close-up */
void
see_monster_closeup(struct monst *mtmp)
{
if (!svm.mvitals[monsndx(mtmp->data)].seen_close) {
svm.mvitals[monsndx(mtmp->data)].seen_close = TRUE;
if (Role_if(PM_TOURIST)) {
more_experienced(experience(mtmp, 0), 0);
newexplevel();
}
}
}
/* mark a monster type as seen clse-up when we see it next to us */
void
see_nearby_monsters(void)
{
coordxy x, y;
/* currently used only for tourists ... */
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))
see_monster_closeup(mtmp);
}
}
/*mon.c*/