Adjust seenres on visible gear removal

If a monster sees you remove some piece of gear that grants a
resistance, it will remove that resistance from its list of remembered
resistances and be willing to try attacking you with that adtyp again.
This avoids the situation where you put on a ring of cold, get hit with
one cold attack, and then can remove it because all the monsters nearby
will permanently remember you as being cold resistant (but even after
this change a wily hero could still step into a niche and do it without
any monsters seeing, so trick them into thinking she's still cold
resistant...).  The hero could still be resistant if there were multiple
sources to begin with, of course, but the monsters will test it and
learn that again if necessary.

It's a little weird that the monsters can recognize the intrinsic
granted by the item being removed, but they display knowledge of
unidentified (by the hero) objects in many other circumstances too, so I
hope it's forgivable in the pursuit of having them act more cleverly
about resuming previously-resisted attacks like this.  Another approach
that avoids the gear recognition, blanking seenres on any gear change,
can result in odd situations like orcs treating their own cloaks as
potential sources of many different resistances, which also seems silly.
This commit is contained in:
Michael Meyer
2023-08-25 14:21:06 -04:00
committed by Pasi Kallinen
parent 99683d94b4
commit 38cda5ad52
4 changed files with 42 additions and 1 deletions

View File

@@ -1694,7 +1694,9 @@ extern const char *msummon_environ(struct permonst *, const char **);
extern const struct permonst *raceptr(struct monst *);
extern boolean olfaction(struct permonst *);
unsigned long cvt_adtyp_to_mseenres(uchar);
unsigned long cvt_prop_to_mseenres(uchar);
extern void monstseesu(unsigned long);
extern void monstunseesu(unsigned long);
extern boolean resist_conflict(struct monst *);
extern boolean mon_knows_traps(struct monst *, int);
extern void mon_learns_traps(struct monst *, int);

View File

@@ -88,7 +88,9 @@ enum m_seen_resistance {
#define m_seenres(mon, mask) ((mon)->seen_resistance & (mask))
#define m_setseenres(mon, mask) ((mon)->seen_resistance |= (mask))
#define m_clearseenres(mon, mask) ((mon)->seen_resistance &= ~(mask))
#define monstseesu_ad(adtyp) monstseesu(cvt_adtyp_to_mseenres(adtyp))
#define monstunseesu_prop(prop) monstunseesu(cvt_prop_to_mseenres(prop))
struct monst {
struct monst *nmon;