MCPcopy Create free account
hub / github.com/NetHack/NetHack / see_monster_closeup

Function see_monster_closeup

src/mon.c:5970–6021  ·  view source on GitHub ↗

mark individual monster type as seen from close-up, if we haven't seen it nearby before */

Source from the content-addressed store, hash-verified

5968/* mark individual monster type as seen from close-up,
5969 if we haven't seen it nearby before */
5970void
5971see_monster_closeup(struct monst *mtmp, boolean photo)
5972{
5973 int mndx;
5974
5975 if (Hallucination || (Blind && !Blind_telepat))
5976 return;
5977
5978 mndx = monsndx(mtmp->data);
5979 if (M_AP_TYPE(mtmp) == M_AP_MONSTER && !sensemon(mtmp))
5980 mndx = mtmp->mappearance;
5981 if (mndx == PM_LONG_WORM && gn.notonhead)
5982 mndx = PM_LONG_WORM_TAIL;
5983
5984 if (!svm.mvitals[mndx].seen_close) {
5985 svm.mvitals[mndx].seen_close = 1;
5986 svc.context.lifelist.total_seen_upclose++;
5987 }
5988
5989 /* hallucinatory monsters don't reach here--they're not recorded;
5990 being able to see invisible doesn't make invisible monsters show up
5991 on photos; likewise, telepathy allows hero to see hidden monsters
5992 but doesn't cause them to appear on photos */
5993 if (photo && !mtmp->minvis && !mtmp->mundetected
5994 && (M_AP_TYPE(mtmp) == M_AP_NOTHING
5995 || M_AP_TYPE(mtmp) == M_AP_MONSTER)) {
5996 if (M_AP_TYPE(mtmp) == M_AP_MONSTER) /* cloned Wizard of Yendor */
5997 mndx = mtmp->mappearance;
5998
5999 if (!svm.mvitals[mndx].photographed) {
6000 svm.mvitals[mndx].photographed = 1;
6001 svc.context.lifelist.total_photographed++;
6002
6003 /* tourist earns points (toward EXP but not final score) for
6004 the first instance of each type of monster photographed;
6005 worm tail can be photographed but yields no EXP bonus */
6006 if (Role_if(PM_TOURIST)
6007 /* suppress extra points for photographing the pet that hero
6008 started with (unless it has changed shape due to growing
6009 up or being polymorphed) */
6010 && (mtmp->m_id != svc.context.startingpet_mid
6011 || mndx != svc.context.startingpet_typ)
6012 /* monsndx() check covers worm tail and also disguised
6013 Wizard of Yendor; experienced() won't yield a reasonable
6014 value for those */
6015 && mndx == monsndx(mtmp->data)) {
6016 more_experienced(experience(mtmp, 0), 0);
6017 newexplevel();
6018 }
6019 }
6020 }
6021}
6022
6023/* mark a monster type as seen close-up when we see it next to us */
6024void

Callers 3

makedogFunction · 0.85
see_nearby_monstersFunction · 0.85
do_blinding_rayFunction · 0.85

Calls 4

sensemonFunction · 0.85
more_experiencedFunction · 0.85
experienceFunction · 0.85
newexplevelFunction · 0.85

Tested by

no test coverage detected