diff --git a/include/decl.h b/include/decl.h index 6298e0621..4e674d6a2 100644 --- a/include/decl.h +++ b/include/decl.h @@ -1061,6 +1061,7 @@ struct instance_globals_w { /* new */ struct win_settings wsettings; /* wintype.h */ + long were_changes; /* were.c, allmain.c */ boolean havestate; unsigned long magic; /* validate that structure layout is preserved */ diff --git a/src/allmain.c b/src/allmain.c index 0efec2ac9..918da029a 100644 --- a/src/allmain.c +++ b/src/allmain.c @@ -201,6 +201,7 @@ moveloop_core(void) struct monst *mtmp; /* set up for a new turn */ + gw.were_changes = 0L; mcalcdistress(); /* adjust monsters' trap, blind, etc */ /* reallocate movement rations to monsters; don't need @@ -324,6 +325,11 @@ moveloop_core(void) (void) dosearch0(1); if (Warning) warnreveal(); + if (gw.were_changes) { + /* update innate intrinsics (mainly Drain_resistance) */ + set_uasmon(); + gw.were_changes = 0L; + } mkot_trap_warn(); dosounds(); do_storms(); diff --git a/src/decl.c b/src/decl.c index fe16b2b44..d06dcf9b6 100644 --- a/src/decl.c +++ b/src/decl.c @@ -863,6 +863,7 @@ static const struct instance_globals_w g_init_w = { UNDEFINED_PTR, /* wportal */ /* new */ { wdmode_traditional, NO_COLOR }, /* wsettings */ + 0L, /* were.c, allmain.c */ TRUE, /* havestate*/ IVMAGIC /* w_magic to validate that structure layout has been preserved */ }; diff --git a/src/were.c b/src/were.c index 9baa4155e..551ad46e6 100644 --- a/src/were.c +++ b/src/were.c @@ -16,6 +16,7 @@ were_change(struct monst *mon) && !rn2(night() ? (flags.moonphase == FULL_MOON ? 3 : 30) : (flags.moonphase == FULL_MOON ? 10 : 50))) { new_were(mon); /* change into animal form */ + gw.were_changes++; if (!Deaf && !canseemon(mon)) { const char *howler; @@ -39,9 +40,8 @@ were_change(struct monst *mon) } } else if (!rn2(30) || Protection_from_shape_changers) { new_were(mon); /* change back into human form */ + gw.were_changes++; } - /* update innate intrinsics (mainly Drain_resistance) */ - set_uasmon(); /* new_were() doesn't do this */ } int @@ -203,6 +203,7 @@ you_were(void) return; } (void) polymon(u.ulycn); + gw.were_changes++; } void