MCPcopy Index your code
hub / github.com/NetHack/NetHack / minliquid_core

Function minliquid_core

src/mon.c:960–1122  ·  view source on GitHub ↗

guts of minliquid() */

Source from the content-addressed store, hash-verified

958
959/* guts of minliquid() */
960staticfn int
961minliquid_core(struct monst *mtmp)
962{
963 boolean inpool, inlava, infountain;
964 boolean waterwall = is_waterwall(mtmp->mx,mtmp->my);
965
966 /* [ceiling clingers are handled below] */
967 inpool = (is_pool(mtmp->mx, mtmp->my)
968 && (!(is_flyer(mtmp->data) || is_floater(mtmp->data))
969 /* there's no "above the surface" on the plane of water */
970 || Is_waterlevel(&u.uz)));
971 inlava = (is_lava(mtmp->mx, mtmp->my)
972 && !(is_flyer(mtmp->data) || is_floater(mtmp->data)));
973 infountain = IS_FOUNTAIN(levl[mtmp->mx][mtmp->my].typ);
974
975 /* Flying and levitation keeps our steed out of the liquid
976 (but not water-walking or swimming; note: if hero is in a
977 water location on the Plane of Water, flight and levitating
978 are blocked so this (Flying || Levitation) test fails there
979 and steed will be subject to water effects, as intended) */
980 if (mtmp == u.usteed && (Flying || Levitation) && !waterwall)
981 return 0;
982
983 /* Gremlin multiplying won't go on forever since the hit points
984 * keep going down, and when it gets to 1 hit point the clone
985 * function will fail.
986 */
987 if (mtmp->data == &mons[PM_GREMLIN] && (inpool || infountain) && rn2(3)) {
988 if (split_mon(mtmp, (struct monst *) 0))
989 dryup(mtmp->mx, mtmp->my, FALSE);
990 if (inpool)
991 water_damage_chain(mtmp->minvent, FALSE);
992 return 0;
993 } else if (mtmp->data == &mons[PM_IRON_GOLEM] && inpool && !rn2(5)) {
994 int dam = d(2, 6);
995
996 if (cansee(mtmp->mx, mtmp->my))
997 pline_mon(mtmp, "%s rusts.", Monnam(mtmp));
998 mtmp->mhp -= dam;
999 if (mtmp->mhpmax > dam)
1000 mtmp->mhpmax -= dam;
1001 if (DEADMONSTER(mtmp)) {
1002 mondied(mtmp);
1003 if (DEADMONSTER(mtmp))
1004 return 1;
1005 }
1006 water_damage_chain(mtmp->minvent, FALSE);
1007 return 0;
1008 }
1009
1010 if (inlava) {
1011 /*
1012 * Lava effects much as water effects. Lava likers are able to
1013 * protect their stuff. Fire resistant monsters can only protect
1014 * themselves --ALI
1015 */
1016 if (!is_clinger(mtmp->data) && !likes_lava(mtmp->data)) {
1017 /* not fair...? hero doesn't automatically teleport away

Callers 1

minliquidFunction · 0.85

Calls 15

is_waterwallFunction · 0.85
is_poolFunction · 0.85
is_lavaFunction · 0.85
rn2Function · 0.85
split_monFunction · 0.85
dryupFunction · 0.85
water_damage_chainFunction · 0.85
dFunction · 0.85
pline_monFunction · 0.85
MonnamFunction · 0.85
mondiedFunction · 0.85
tele_restrictFunction · 0.85

Tested by

no test coverage detected