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

Function green_mon

src/muse.c:3268–3307  ·  view source on GitHub ↗

TRUE if monster appears to be green; we go by the display color. The alternative was to just pick things that seem plausibly green (which didn't necessarily match the categorization by the color of the text). iflags.use_color is not meant for game behavior decisions */

Source from the content-addressed store, hash-verified

3266 by the color of the text).
3267 iflags.use_color is not meant for game behavior decisions */
3268staticfn boolean
3269green_mon(struct monst *mon)
3270{
3271 struct permonst *ptr = mon->data;
3272
3273 if (Hallucination)
3274 return FALSE;
3275 return (ptr->mcolor == CLR_GREEN || ptr->mcolor == CLR_BRIGHT_GREEN);
3276#if 0
3277 if (iflags.use_color)
3278 return (ptr->mcolor == CLR_GREEN || ptr->mcolor == CLR_BRIGHT_GREEN);
3279 else {
3280 /* approximation */
3281 if (strstri(ptr->pmnames[NEUTRAL], "green")
3282 || (ptr->pmnames[MALE] && strstri(ptr->pmnames[MALE], "green"))
3283 || (ptr->pmnames[FEMALE]
3284 && strstri(ptr->pmnames[FEMALE], "green")))
3285 return TRUE;
3286 switch (monsndx(ptr)) {
3287 case PM_FOREST_CENTAUR:
3288 case PM_GARTER_SNAKE:
3289 case PM_GECKO:
3290 case PM_GREMLIN:
3291 case PM_HOMUNCULUS:
3292 case PM_JUIBLEX:
3293 case PM_LEPRECHAUN:
3294 case PM_LICHEN:
3295 case PM_LIZARD:
3296 case PM_WOOD_NYMPH:
3297 return TRUE;
3298 default:
3299 if (is_elf(ptr) && !is_prince(ptr) && !is_lord(ptr)
3300 && ptr != &mons[PM_GREY_ELF])
3301 return TRUE;
3302 break;
3303 }
3304 }
3305 return FALSE;
3306#endif
3307}
3308
3309/*muse.c*/

Callers 1

muse_unslimeFunction · 0.85

Calls 1

strstriFunction · 0.85

Tested by

no test coverage detected